LinuxQuestions.org
Help answer threads with 0 replies.
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 01-16-2006, 08:56 AM   #1
bogoda
Member
 
Registered: Jan 2006
Posts: 32
Blog Entries: 2

Rep: Reputation: 15
Thumbs up How to Write Script Program as Deamon


Hi,

I want to write a program to run java program as deamon when the system boot up.

How can I write it on RH9.

Any one kow the answer plse.

Thank you.
 
Old 01-16-2006, 09:01 AM   #2
UnderDark
Member
 
Registered: Aug 2005
Location: USA.Michigan
Distribution: Slackware 10.1
Posts: 34

Rep: Reputation: 15
To make any script/program run in the background, you simply append an amperstand to the end
ie: /bin/sh /home/underdark/update.sh >/dev/null &

To make it run on startup, you need to find the startup scripts (On my system: /etc/rc.d/) and either add or edit one to include the line to run your script
 
Old 01-16-2006, 09:33 AM   #3
Lazarus
Member
 
Registered: Dec 2001
Location: Kent in UK
Distribution: Fedora 2
Posts: 170

Rep: Reputation: 30
I put anything I want run at startup in

/etc/rc.d/rc.local

This is run after everything else at boot up. I run some demons and mount some filesystems. There are many other ways of skinning this cat!
 
Old 01-16-2006, 10:33 AM   #4
bogoda
Member
 
Registered: Jan 2006
Posts: 32
Blog Entries: 2

Original Poster
Rep: Reputation: 15
Thumbs up Further Expain Need

Quote:
Originally Posted by Lazarus
I put anything I want run at startup in

/etc/rc.d/rc.local

This is run after everything else at boot up. I run some demons and mount some filesystems. There are many other ways of skinning this cat!

Hello,

Can you tell me what kind of scripts add in the /etc/rc.d/rc.local

How can i see that my program is working.
 
Old 01-16-2006, 11:44 AM   #5
Lazarus
Member
 
Registered: Dec 2001
Location: Kent in UK
Distribution: Fedora 2
Posts: 170

Rep: Reputation: 30
This is what I have at the end of my rc.local. Just an example for you. It mounts various filesystems. shareprx is run as a demon hence the & at the end of the line. Commands like mount_spare are just bash scripts of mine.
I should think you can run most things. Append your stuff to the end of the file. Before you change a system file I keep a copy as insurance. ie
cp rc.local rc.local.original

have fun!


ifconfig eth0 192.168.1.2
hostname server
modprobe aic7xxx_old
modprobe ppa
#
swapon /dev/hdb2
#
mount -t reiserfs /dev/home /home
/home/source/shell/mount_spare
/home/source/shell/mount_disk2
/home/source/shell/mount_music
/home/source/shell/mount_cdimage
#
#
# restart xinetd else port 2007 for dialout not available
# for some reason
#
/etc/rc.d/init.d/xinetd restart
cd /home/teletext
/home/teletext/shareprx batch&
#
# start kiss server
/home/source/shell/run_kiss_server
#
#
 
Old 01-16-2006, 11:47 AM   #6
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
/etc/rc.d/rc.local is the Slackware style for custom bootup calls; other distros have a different system, but if you poke around in /etc/rc.* you'll find it. Take a look at your distro's particular forum here at LQ and I'm sure you'll find more specifics.
 
Old 01-18-2006, 09:09 AM   #7
bogoda
Member
 
Registered: Jan 2006
Posts: 32
Blog Entries: 2

Original Poster
Rep: Reputation: 15
Got it But Files are empty

Quote:
Originally Posted by Lazarus
This is what I have at the end of my rc.local. Just an example for you. It mounts various filesystems. shareprx is run as a demon hence the & at the end of the line. Commands like mount_spare are just bash scripts of mine.
I should think you can run most things. Append your stuff to the end of the file. Before you change a system file I keep a copy as insurance. ie
cp rc.local rc.local.original

have fun!


ifconfig eth0 192.168.1.2
hostname server
modprobe aic7xxx_old
modprobe ppa
#
swapon /dev/hdb2
#
mount -t reiserfs /dev/home /home
/home/source/shell/mount_spare
/home/source/shell/mount_disk2
/home/source/shell/mount_music
/home/source/shell/mount_cdimage
#
#
# restart xinetd else port 2007 for dialout not available
# for some reason
#
/etc/rc.d/init.d/xinetd restart
cd /home/teletext
/home/teletext/shareprx batch&
#
# start kiss server
/home/source/shell/run_kiss_server
#
#


I put simple echo "Checking running" command in /etc/rc.d/rc.local file

But that file have only two lines like
touch /var/...
I look for The path specify.BUt those files are empty files.

How can i add my file to there.

 
Old 01-21-2006, 01:14 AM   #8
bogoda
Member
 
Registered: Jan 2006
Posts: 32
Blog Entries: 2

Original Poster
Rep: Reputation: 15
Problem in daemon

Quote:
Originally Posted by Lazarus
This is what I have at the end of my rc.local. Just an example for you. It mounts various filesystems. shareprx is run as a demon hence the & at the end of the line. Commands like mount_spare are just bash scripts of mine.
I should think you can run most things. Append your stuff to the end of the file. Before you change a system file I keep a copy as insurance. ie
cp rc.local rc.local.original

have fun!


ifconfig eth0 192.168.1.2
hostname server
modprobe aic7xxx_old
modprobe ppa
#
swapon /dev/hdb2
#
mount -t reiserfs /dev/home /home
/home/source/shell/mount_spare
/home/source/shell/mount_disk2
/home/source/shell/mount_music
/home/source/shell/mount_cdimage
#
#
# restart xinetd else port 2007 for dialout not available
# for some reason
#
/etc/rc.d/init.d/xinetd restart
cd /home/teletext
/home/teletext/shareprx batch&
#
# start kiss server
/home/source/shell/run_kiss_server
#
#

I cofused about daemon doing it many ways.

Can u tell me exact way to write a Daemon and place it where
with each and every steps Beacuse i am new so I stuck here.
My deamon objective is to execute a java program at system boot up.
Also i want to clarify whether my Daemon is running at start up.

If u can please hlp me.
 
  


Reply


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
HELP:write a CGI program with shell script supermyself Programming 3 06-12-2005 04:10 PM
Help in writing a C program as a service deamon cranium2004 Programming 9 10-28-2004 08:31 AM
How to write a Script Blake Linux - Software 6 07-18-2004 12:41 PM
Help with a script I need to write... cmfarley19 Programming 9 12-06-2003 01:10 PM
Write to port (C program) dummyagain Programming 8 10-24-2003 11:50 AM

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

All times are GMT -5. The time now is 09:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration