Clear apache log or change log while apache is running - apache

I want to clear my Apache log without stopping apache or anything like that, but I have a problem while apache's running I can not edit the active log file.
I attempted some solutions but all is not good, or it just does not work - for example:
cat /dev/null > /path/to/log.log
It works but it kills the CPU.
Now I want to know has anybody got a good solution for clearing log files or creating a new log file with a new name every N hours which doesn't kill the CPU,RAM,etc ...
What can I do? Please give me a solution :((
Kind regards.

Install and set up logrotate, assuming you are on a debian or ubuntu distribution do this :
$ sudu apt-get install logrotate
This is an "industry standard" solution for what you want to achieve.
Recommended reading:
http://articles.slicehost.com/2010/6/30/understanding-logrotate-on-ubuntu-part-1
http://articles.slicehost.com/2010/6/30/understanding-logrotate-on-centos-part-1
https://unix.stackexchange.com/questions/66292/learning-about-general-logging-logrotation-on-linux

Related

Elm install always fails with "ConnectionTimeout" error (in WSL)

I'm new to Elm. and I'm not good at English. So, if any ambiguous or wrong thing is there, please let me correct it.
----------- edit -----------
All my problem below is on WSL. when I'm trying on windows, all work fine. then... why elm install doesn't work on WSL? did you have any idea?
-------- problem --------
when I try to elm-test init, it doesn't work like below
$ elm-test init
Here is my plan:
Add:
elm/random 1.0.0
elm-explorations/test 1.2.2
Would you like me to update your elm.json accordingly? [Y/n]:
-- PROBLEM DOWNLOADING PACKAGE -------------------------------------------------
I was trying to download the source code for elm/random 1.0.0, so I tried to
fetch:
https://github.com/elm/random/zipball/1.0.0/
But my HTTP library is giving me the following error message:
ConnectionTimeout
Are you somewhere with a slow internet connection? Or no internet? Does the link
I am trying to fetch work in your browser? Maybe the site is down? Does your
internet connection have a firewall that blocks certain domains? It is usually
something like that!
but my Browser(Chrome) is working beautifully, and even in WSL (the environment that I run elm-test init command at) is too.
$ curl https://github.com/elm/random/zipball/1.0.0/
https://codeload.github.com/elm/random/legacy.zip/1.0.0<body>You are being redirected.</body></html>
then I also try again to redirect the URL
$ curl https://codeload.github.com/elm/random/legacy.zip
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
I think there's no Network Problem. My PC can connect with the repo, and I think it will be downloaded well.
I lastly tried just elm install, and that throws the same error too. it seems like Elm can't connect with the repo, even if My PC can.
$ elm install elm/random
Here is my plan:
Add:
elm/random 1.0.0
Would you like me to update your elm.json accordingly? [Y/n]:
-- PROBLEM DOWNLOADING PACKAGE -------------------------------------------------
I was trying to download the source code for elm/random 1.0.0, so I tried to
fetch:
https://github.com/elm/random/zipball/1.0.0/
But my HTTP library is giving me the following error message:
ConnectionTimeout
Are you somewhere with a slow internet connection? Or no internet? Does the link
I am trying to fetch work in your browser? Maybe the site is down? Does your
internet connection have a firewall that blocks certain domains? It is usually
something like that!
Please help me, what should I do?
I recently had reason to use WSL for elm development. It wasn't much fun and I'm glad to be back on Mac! What I found was that certain disk operations on WSL seemed to go very slowly and that could lead a variety of weird issues.
I was using Webstorm, which does not handle WSL well, so in the end I did everything on C: drive (rather than in /home/...) so that webstorm could run the windows version of elm-format, while my node development environment was run on the linux layer.
That's not a precise answer to your question but just to say that it can be done, but its not an ideal way to write Elm code in my experience
I had same issue and it was solved.
It was due to DNS server settings.
Create a file /etc/resolv.conf and write the following line.
nameserver 8.8.8.8
Then WSL will refer to Google Public DNS and works fine.
However, when restart WSL, the settings revert back.
Therefore, the following settings are also required.
Create a file /etc/wsl.conf and write the following line.
[network]
generateResolvConf = false
wsl --shutdown and restart WSL.
Reference link
https://github.com/microsoft/WSL/issues/4285#issuecomment-522201021

apache2.4 , where to setup mod_ssl, dont see any mod_ssl.so file

Problem is the plain vanila apache is working, the moment I say sslEngine ON
it gives error, I am not able to find where any ssl setup is?
it does not create any log as well..
How this ssl setup is done? will copying a mod_ssl.so file from outside will work?
Apache version : 2.4.29
Os is RHEL 6.7
If this Red Hat documentation is not wrong the RHEL 6.x releases include Apache/2.2. Since you have Apache/2.4 I'd say you probably have an unofficial binary. Such binaries could of course have been installed in any conceivable way so this answer can easily be wrong. Yet making the hopefully safe assumption that you're still using the package manager and you just switched to a third-party repository you can try this:
yum install mod_ssl
Then tweak /etc/httpd/conf.d/ssl.conf to your liking and restart the service:
service httpd graceful
After a lot of research, I found below command which can help you show the actual issue while restarting. when I ran this it told me that .csr which I was using were wrong. I could not get this when I normally started the Apache but this command helped.
replace below with location where apache is installed and conf file is located, this will print the error ( if any).
/xxx/app/xxx/apache22/0/bin/apachectl_worker -DSSL -k start -f /xxx/app/xxx/apache22/0/conf/xxx.conf

Cpanel - There is another upcp process running

I have this error when i try to use cpanel upgrade to new version
There is another upcp process running, and you are watching the log from the existing process.
And then in box i see
Unable to find log file: /var/cpanel/updatelogs/last
please help how can i terminate as ps aux | grep upcp shows no process running. I also have deleted update_in_progress.txt from /usr/local/cpanel. I am able to access tweak settings but not able to upgrade. Also tried upcp --force. Please help
If /scripts/upcp --force is not working, then I think your best option is to reboot the server and run it again.

#1 - Can't create/write to file '/var/folders/

I get the following error(see. figure) in my Xampp and can not access mySQL through XAMPP and phpMyAdmin. In this link-1 and link-2 possible solution is given; but none of them woks in Mac OS 10.9
I assume the problem is with configuration file my.cnf which is located in the /Applications/XAMPP/xamppfiles/etc/my.cnf.
Any suggestion will be appreciate. Thanks.
Completely stop XAMPP, this means stop apache, ftp and mysql.
Open the program called Terminal.
Type in sudo -i to become root (or do su root if the first doesn’t work for you).
You are most probably asked for a password which you have to enter while no characters are displayed.
Execute chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf .
Exit your root shell with exit or just close Terminal.
Restart XAMPP (apache, ftp and mysql).
From: http://slopjong.de/2009/08/31/houston-i-cant-write-to-file/
Solution
Reinstall Xampp. Before reinstalling delete all the files, take away your htdoc and database folder to other place of your hdd.
The database location in Mac OS-10.9 is
cd '/Applications/XAMPP/xamppfiles/var/mysql/'
Htdoc location
cd '/Applications/XAMPP/xamppfiles/htdocs/'
When you complete reinstallation put all the folders to corresponding location and your database will be automatically update.
I looked some other solution but none of them seems work. I was scare if I remove the database to other location and import later will it work or not. And luckily it works, but as precaution careful when you remove big database.

How do I restart qmail?

I have a VPS and root ssh access. I'm sure I've restarted Qmail before via SSH but can't figure out how.
I've tried to run /etc/init.d/qmail restart but all I get is -bash: /etc/init.d/qmail: No such file or directory.
I've also run:
ps ax | grep qmail-send
12035 pts/0 S+ 0:00 grep qmail-send
I'd greatly appreciate direction on how to do this, and also what the process would be for figuring this sort of thing out in the future would be.
Many thanks.
Stevie
Edit:
While I use Plesk, I've also got WebMin installed, and it tells me that the command to start Qmail is: "Just run rc script", while the command to stop it is: "Just kill qmail-send". I'm still a little lost though.
Turns out, my 1&1 Plesk driven VPS is crap... it's using Postfix rather than Qmail, which explains why it cannot be restarted.
This is blurred by the fact that my mailbox configurations are automatically stored in a folder called /var/qmail/mailnames
Thanks!
Not sure my answer would still be actual for you, but anyway -
if on Plesk, you can check whether Qmail is installed with
rpm -q psa-qmail
yet lack of /etc/init.d/qmail script definitely indicates there are no Qmail installed. At some point it was declared that Postfix is replacing Qmail for Plesk.
Postfix can be restarted like any other Linux service
/etc/init.d/postfix {start|stop|restart|reload|abort|flush|check|status|condrestart}
Depends on location of installation
/etc/init.d/qmail restart (will probably not work)
So try the following commands
sudo pkill -9 qmail
/var/qmail/bin/qmail-start