LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 02-21-2006, 01:32 PM   #1
jsheffie
Member
 
Registered: Dec 2004
Location: Florida, USA
Distribution: Suse 10.0, OSX.4, Solaris 10
Posts: 163

Rep: Reputation: 30
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
 
Old 02-21-2006, 01:34 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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...
 
Old 02-21-2006, 02:30 PM   #3
this213
Member
 
Registered: Dec 2001
Location: ./
Distribution: Fedora, CentOS, RHEL, Gentoo
Posts: 167

Rep: Reputation: 34
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
 
Old 02-21-2006, 04:17 PM   #4
seculor
LQ Newbie
 
Registered: Jan 2006
Distribution: Fedora
Posts: 6

Rep: Reputation: 0
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).
 
Old 03-08-2006, 12:36 PM   #5
crouse
LQ Newbie
 
Registered: May 2005
Location: USA
Posts: 19

Rep: Reputation: 0
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 &
 
Old 03-08-2006, 03:41 PM   #6
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

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


Reply



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
LXer: Telsasoft, a Telecommunications Service Assurance Software Company Based in Minneapolis, Minnesota Received Order for a Set of GSM CDR (Call Detail Record) Reports from a Regional GSM Network Service LXer Syndicated Linux News 0 01-03-2006 09:46 PM
Making a service as a system service Dakkar SUSE / openSUSE 2 07-13-2005 07:36 AM
Help in writing a C program as a service deamon cranium2004 Programming 9 10-28-2004 07:31 AM
/sbin/service is empty every weekend and changed to service.1 LineS Linux - General 0 05-24-2004 02:08 AM
cd writing software which supports multisession writing jayakrishnan Linux - General 3 03-24-2003 05:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:04 PM.

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