LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-20-2012, 01:28 AM   #1
gajananh999
Member
 
Registered: Aug 2012
Posts: 94

Rep: Reputation: Disabled
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.

Last edited by gajananh999; 11-20-2012 at 01:38 AM.
 
Old 11-20-2012, 02:51 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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

Last edited by acid_kewpie; 11-20-2012 at 07:56 AM.
 
Old 11-20-2012, 02:57 AM   #3
gajananh999
Member
 
Registered: Aug 2012
Posts: 94

Original Poster
Rep: Reputation: Disabled
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.
 
Old 11-20-2012, 03:20 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 11-20-2012, 07:30 AM   #5
Yaniv-Fer
Member
 
Registered: Feb 2006
Distribution: Fedora,Solaris
Posts: 46

Rep: Reputation: 15
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
 
Old 11-20-2012, 09:51 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by gajananh999 View Post
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.
 
  


Reply

Tags
services


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between deamon and service in Linux? abhinav4 Linux - Newbie 9 06-15-2010 02:55 PM
Any deamon service for rlogin/rcp ust Linux - Newbie 1 09-12-2008 07:01 AM
How to install default start/stop script links for deamon directoryserver? kim0 Linux - Newbie 0 12-25-2007 06:37 AM
How to stop java deamon in clustered environment through shell script rakeshnair83 Linux - Software 0 12-18-2007 05:59 AM
Help in writing a C program as a service deamon cranium2004 Programming 9 10-28-2004 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration