0
votes
1answer
14 views

For a given directory, how do I concatenate the tail end of recently modified files to a new file?

In case there's a better solution to the problem, my goal is to be able to quickly analyze ALL recent apache activity in /usr/local/apache/domlogs. The usefulness of this is when the server load is ...
0
votes
1answer
90 views

Automatic login for mysql used in CGI script

I have written a CGI script using bash which executes a MySQL query. For MySQL authentication , automatic login is used by supplying the credentials in .my.cnf file as shown below . # the following ...
2
votes
1answer
89 views

how to write `fuser -k -n tcp 80` into a bash script?

Recently, my site's visitor-ship increased sharply. My Apaches' always crash. I'm seeing lines like these in the httpd/error_log: [Sun Apr 13 08:57:18 2014] [warn] child process 7792 still did not ...
2
votes
1answer
60 views

redirection failing for CGI program

I'm trying to redirect the contents of command output to a file in a CGI program. The issue for me is that the output file is not getting created. The CGI Code snippet is as follows: #!/bin/bash ...
5
votes
3answers
310 views

Apache server starts automatically after stopping the service

What can cause httpd to start automatically after stopping it? In a bash script I need to first stop apache web server. This is the script: apachectl stop; while pgrep httpd; do sleep 1; done echo ...
1
vote
1answer
80 views

GoAccess won't redirect its output as a CGI script

I've been pulling my hair with this script: #!/bin/bash echo Content-type: text/html echo "" goaccess -f /var/www/log/access.log -a | tee Which runs perfectly on the command line (generates HTML ...
2
votes
2answers
134 views

Sanitize Apache access log files?

We have this code in a shell script that pipes output for Apache to log. declare -a values=( $taintRequestVals ) for item in ${!values[@]} do cat $apacheLog | sed ...
0
votes
2answers
241 views

Find PHP process that logs to file

I have started a PHP script via browser and due to a loop error the script continues to be executed even after closing the browser. I am noticing it since the script is logging error messages to my ...
0
votes
1answer
151 views

Bash config files being read in contradiction to `man bash`

While trying to determine the differences between .bashrc and .bash_profile I notice that .bashrc is never read, and that .bash_profile is only read from SSH, but not from PHP. This seems to ...
3
votes
2answers
889 views

Scripting htdigest -c /path/to/file/$user $user $password in Bash

I want to be able to script with a password in variable $password. htdigest -c /etc/apache2/pw/$user $user $password At the moment it asks me to manually enter a password, this is not going to be ...
4
votes
1answer
1k views

Bash, remove lines containing string with grep

This is currently deleting the whole contents of the file in question: #!/bin/bash rpc_port="9201"; dir="/etc/apache2/ports.conf" cat $dir | grep -v "Listen $rpc_port" > $dir The file contents: ...
1
vote
5answers
1k views

Start/stop program from website

I have some users on my machine that I allow to run small Mumble voice servers. I would like for them to be able to start/stop their voice server from a website (being ran by Apache). With the current ...