LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Stop All the deamon service at the particular time (https://www.linuxquestions.org/questions/linux-newbie-8/stop-all-the-deamon-service-at-the-particular-time-4175437911/)

gajananh999 11-20-2012 01:28 AM

Stop All the deamon service at the particular time
 
Dear Everyone,

I have some 10 service which i started using daemon using daemon tools. and i want to stop these all service at the end of the day at night 12.10 clock and i want to perform some cleaning process daily.

So may i know how can i do this.

acid_kewpie 11-20-2012 02:51 AM

just put a script in cron which stops each one in turn, fairly simple stuff.

crontab:

Code:

10 0 * * * /path/to/my/script
myscript:

Code:

#!/bin/sh
service one stop
service two stop


gajananh999 11-20-2012 02:57 AM

Dear acid_kewpie,

I can't use cron because i m working on Amazon EC2 linux machine. cron wont work on this. so only we start all the service using daemon as daemon tools.

acid_kewpie 11-20-2012 03:20 AM

why won't cron work? Did you not think you should have told us in the first place if the most obvious solution for some reason isn't viable? Pretty sure it will work fine though.

Yaniv-Fer 11-20-2012 07:30 AM

Cron is the best solution. if it is not available for some reason... try using "at" but i would recommend that you figure out how to use cron on Amazon...

AT run a job just once
http://www.thegeekstuff.com/2010/06/...mand-examples/


Cron
a good starting point would be "crontab" you can schedule your scripts there.
see http://en.wikipedia.org/wiki/Cron for examples.

example:
10 00 * * * /path/to/your/script.sh

TB0ne 11-20-2012 09:51 AM

Quote:

Originally Posted by gajananh999 (Post 4833088)
Dear acid_kewpie,

I can't use cron because i m working on Amazon EC2 linux machine. cron wont work on this. so only we start all the service using daemon as daemon tools.

Really??? Because according to Amazon, cron works just fine:
https://forums.aws.amazon.com/thread...ssageID=218767

And if you want to not use cron (for some reason), write a script and have it sleep for a certain amount of time, wake up and check the time. If it matches what you want, do something.


All times are GMT -5. The time now is 12:58 PM.