I am running a cron-ed bid script to remove the cache hit and each IP ad service is shown in bytes . The script (ProxyUsage.bash) has two parts:
- Find unique IPs and create a bash script to increase the hits and bytes
- Hit and Bit Per-mother
proxies. Bash
#! / Usr / bin / env bash sudo gock -f / home / max / script / unique ip.awk /var/log/squid3/access.log.1 & gt; /home/maxg/scripts/pxyUsage.bash Source /home/maxg/scripts/pxyUsage.bash
uniqueIP.awk
{arrIPs [$ 3 ] ++; } END {for (NIRI in N) {m ++; # Count arrips element # print "array element:" m; ArrAddr [i ++] = n; # Fill arrAddr with IR # Print I "" n; } ArrAddr; # Sort the array values for # (I = 1; i & lt; = m; i ++) {Enter a command line for an IP address # Print ("#! / USR / Bin / NYV bish \ n" ); Printf ("sudo gawk -f /home/maxg/scripts/proxyUsage.awk -vv_Var =% s /var/log/squid3/access.log.1 & gt; / home / maxg / scripts / pxyUsage. Txt \ n ", arrAddr [i])}}
pxyUsage.bash
sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v V_Var = 192.168.1.13 /var/log/squid3/access.log.1 & gt; & Gt; /home/maxg/scripts/pxyUsage.txt sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v v_Var = 192.168.1.14 /var/log/squid3/access.log.1 & gt; & Gt; /home/maxg/scripts/pxyUsage.txt sudo gawk -f /home/maxg/scripts/proxyUsage.awk -v v_Var = 192.168.1.22 /var/log/squid3/access.log.1 & gt; & Gt; /home/maxg/scripts/pxyUsage.txt
TheProxyUsage.bash script runs as scheduled and creates pxyUsage.bash scripts. However, the pxyUsage.text file is not modified with the latest values when the script runs. So far I run pxyUsage.bash myself every day, because I do not understand why the result is not written in the file.
Both loop scripts are set to execute file permissions are actually below:
-rwxr-xr -x 1 maxg maxg 16 Mar 14 08:40 Proxy Suri . Bash-R-R-R-R-1 Maximum Max 910 Mar 15 17:15 proxyUsage.awk -rwxrwxrwx 1 maxg maxg 399 Mar 17 06:10 pxyUsage.bash -rw-rw-rw-1 maxg maxg 2922 March 17 07 : 32 pxyUsage.txt -rw-r - r-- 1 maxg Maxg 781 Mar 16 07:35 Exclusive IP.com
No signals appreciated. Thank you.
The pseudo-TTI command is required (8) and you are not allocated under one Cron (8);
Instead of mixing with sudo (8), the do is allocated to run the script as the only correct user.
If you can not do this, in the root cronbs, do something like this:
Su - Username / path / in / mycommand arg1 arg2 ...
This will work because the root can use a password without any pig (1).
No comments:
Post a Comment