Ask questions and share hosting deals.
New here? Register and read our Community Rules. Accounts are approved by hand.
Hi. Can someone please me how to automate the following commands every 3 hours. I am using Centos 5 32 bit
It would be very appreciated. Thanks
Maybe this'll help? http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-autotasks-cron-configuring.html
Cron.
http://www.cronmaker.com/
@nunim said: Cron. http://www.cronmaker.com/
@nunim said: Cron.
According to that every 3 hours is
0 0 0/3 1/1 * ? *
So would i just type
crontab -e
and put
0 0 0/3 1/1 * ? * service httpd restart
?
@BK_ said: Maybe this'll help? http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-autotasks-cron-configuring.html
Thanks I just put the 3 commands in a file called vpn.sh and then added the cron 0 0 0/3 1/1 * ? * /root/vpn.sh
@imtiax said:
I think it should be 0 */3 * * * /root/vpn.sh
0 */3 * * * /root/vpn.sh
Can only Show you How i would Do it in Ubuntu, i don't know centos and i am no pro at linux.
"crontab -e"
simple shell script: place the 4 lines in a file - call it "vpn.sh" place in root folder
#!/bin/bash service iptables save service openvpn restart service httpd restart
chmod 700 /root/vpn.sh
painfreepc said: esac
That closes a case statement. As there isn't one, it shouldn't be there
case
Use either crontab or cronjob.
@painfreepc that works on CentOS as well.
Comments
Maybe this'll help? http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-autotasks-cron-configuring.html
Cron.
http://www.cronmaker.com/
According to that every 3 hours is
0 0 0/3 1/1 * ? *
So would i just type
crontab -e
and put
0 0 0/3 1/1 * ? * service httpd restart
?
Thanks I just put the 3 commands in a file called vpn.sh and then added the cron
0 0 0/3 1/1 * ? * /root/vpn.sh
I think it should be
0 */3 * * * /root/vpn.shCan only Show you How i would Do it in Ubuntu, i don't know centos and i am no pro at linux.
"crontab -e"
simple shell script:
place the 4 lines in a file - call it "vpn.sh"
place in root folder
chmod 700 /root/vpn.shThat closes a
casestatement. As there isn't one, it shouldn't be thereUse either crontab or cronjob.
@painfreepc that works on CentOS as well.