I've wrote a PHP-Script, and the execution requires sudo permission, because it executes some other system related stuff. So i've added this into the crontab -e
but i can't see, that my script is running correctly.
Command:
*/5 * * * * /usr/bin/php /srv/www/php/script.php && date > /srv/www/php/mylog.log
The only output is the date. No response from my script. It is executable (chmod a+x) and if i use the same command in the terminal as root, everything is okay. So it's up to crontab -e
?
Also i made sure, that my cronjob is running (/var/log/syslog):
Oct 23 16:40:01 $MYMACHINE CRON[13797]: (root) CMD (/usr/bin/php /srv/www/php/script.php && date > /srv/www/php/mylog.log)
And this every 5 mins. Also my "mylog.log" always got the latest timestamp, so i guess, there's might be a problem with the script inside.
EDIT: I've created another test script to check, if the scripts getting executed or not. But the script was executed, so it's a problem inside the script.
I am trying to add dynamically IPs to an iptables chain:
#!/bin/bash
value=`cat whitelist.txt`
#echo "$value"
for i in $(echo $value | tr "," "\n")
do
# process
/sbin/iptables -I teamspeakCommunication --src $i -j ACCEPT
done
May you can see something weird?
mylog.log
?