Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-21-2006, 01:32 PM
|
#1
|
Member
Registered: Dec 2004
Location: Florida, USA
Distribution: Suse 10.0, OSX.4, Solaris 10
Posts: 163
Rep:
|
writing a service...
Hi, I am wanting to write a script to run as a service in the background.
Is there anything special that has to be placed in the script to cause it to continuously run?
for example. send one ping packet once a minute forever.
I am using Bash shell scripting
thanks,
-Me
|
|
|
02-21-2006, 01:34 PM
|
#2
|
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094
|
Something that simple could be run as a cronjob. Just create your script, make it executable and then crontab -e and add a line to execute the script every minute.
I'm sure there's a more elegant way, but I'm too newbie...
|
|
|
02-21-2006, 02:30 PM
|
#3
|
Member
Registered: Dec 2001
Location: ./
Distribution: Fedora, CentOS, RHEL, Gentoo
Posts: 167
Rep:
|
Are you asking how to write a daemon or how to write a script to ping something once per minute?
If the former, there's a decent HowTo that should be enough to get you started: http://www.linuxprofilm.com/articles...mon-howto.html
if the latter:
Code:
$ ping -i60 ADDRESS
|
|
|
02-21-2006, 04:17 PM
|
#4
|
LQ Newbie
Registered: Jan 2006
Distribution: Fedora
Posts: 6
Rep:
|
daemon
There is a tool called "daemon" that can help you setup your script to run as a service. (lookup "libslack and daemon" on google).
|
|
|
03-08-2006, 12:36 PM
|
#5
|
LQ Newbie
Registered: May 2005
Location: USA
Posts: 19
Rep:
|
Quote:
`nohup': Run a command immune to hangups
========================================
`nohup' runs the given COMMAND with hangup signals ignored, so that
the command can continue running in the background after you log out.
Synopsis:
nohup COMMAND [ARG]...
|
IE: nohup ping -i60 ADDRESS &
don't forget the & 
|
|
|
03-08-2006, 03:41 PM
|
#6
|
Member
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595
Rep:
|
Quote:
Originally Posted by crouse
IE: nohup ping -i60 ADDRESS &
don't forget the & 
|
Yep, that's what I would do. Then the ping would run after you logout, as long as the machine isn't turned off.
Peace...
|
|
|
All times are GMT -5. The time now is 11:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|