hi
I want to execute one script every night 9.00 and stop or kill that script that script morning 9.00 clock.
how can i do it.
executing is no problem to using cron job but how to killing the process automatically.
time base
u can use killall <process name>
Last edited by kbukhari on Fri Jan 19, 2007 11:57 am, edited 1 time in total.
-
- Site Admin
- Posts: 5132
- Joined: Fri May 02, 2003 10:24 am
- Location: Karachi
- Contact:
Re:
Dear venky145,
Salam,
Use crontab to achieve this goal.
Best Regards.
Salam,
Use crontab to achieve this goal.
Code: Select all
1 18 * * * exec /path/to/the/run.script
1 09 * * * exec /path/to/the/kill.script
Farrukh Ahmed
cron probl
hi
# this is my firewall
iptables -t nat -F
iptables -F
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -p tcp -o eth0 --dport 5050 -j MASQUERADE
iptables -I INPUT -p tcp -s 0/0 -d 0/0 --dport 3128 -j DROP
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 5050 -j REDIRECT --to-port 3128
/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.1/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.1/32 -d 0/0 --dport 3128 -j ACCEPT
# this is my night pack script
/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.2/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.2/32 -d 0/0 --dport 3128 -j ACCEPT
# this is my cron job
* 21 * * * exec /bin/night
* 09 * * * exec /bin/fwall
in 20.20.1.1 IP is UNlimited pack and 20.20.1.2 if night 9 to morng 9 pack
cron job is executing night 9 and i am getting internet of 20.20.1.2 but morng 9 it's not stoping internet access of 20.20.1.2
if i manually execute the fwall script its working fine.
pls help me
# this is my firewall
iptables -t nat -F
iptables -F
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -p tcp -o eth0 --dport 5050 -j MASQUERADE
iptables -I INPUT -p tcp -s 0/0 -d 0/0 --dport 3128 -j DROP
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 0/0 --dport 5050 -j REDIRECT --to-port 3128
/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.1/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.1/32 -d 0/0 --dport 3128 -j ACCEPT
# this is my night pack script
/sbin/iptables -t nat -A POSTROUTING -s 20.20.1.2/32 -d 0/0 -j MASQUERADE
/sbin/iptables -I INPUT -p tcp -s 20.20.1.2/32 -d 0/0 --dport 3128 -j ACCEPT
# this is my cron job
* 21 * * * exec /bin/night
* 09 * * * exec /bin/fwall
in 20.20.1.1 IP is UNlimited pack and 20.20.1.2 if night 9 to morng 9 pack
cron job is executing night 9 and i am getting internet of 20.20.1.2 but morng 9 it's not stoping internet access of 20.20.1.2
if i manually execute the fwall script its working fine.
pls help me
-
- Site Admin
- Posts: 5132
- Joined: Fri May 02, 2003 10:24 am
- Location: Karachi
- Contact:
Re:
Dear venky145,
Salam,
Check this, http://www.linuxpakistan.net/forum2x/vi ... php?t=6553
Best Regards.
Salam,
Check this, http://www.linuxpakistan.net/forum2x/vi ... php?t=6553
Best Regards.
Farrukh Ahmed