how to make daemon?

Protecting your Linux box

how to make daemon?

Postby server » Tue Dec 26, 2006 11:04 pm

Assalam-o-Alykum!!
how i make my script file into daemon?
Image
  • Welcome In Red Hat Enterprise 4

Image
server
Naik
 
Posts: 83
Joined: Tue Jan 03, 2006 7:41 pm
Website: http://www.DecentNetwork.com
WLM: zeeshan@decentnetwork.com
Yahoo Messenger: shani_rago@yahoo.com
Location: Lahore

Re: how to make daemon?

Postby lambda » Wed Dec 27, 2006 1:54 am

run it like this:

Code: Select all

(/path/to/script > /tmp/output 2>&1 &)
the parens are important. replace /tmp/output with some other log file name, if you want.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby server » Wed Dec 27, 2006 8:44 pm

Assalam-o-Alykum!
i tried but its not working :cry: ,

Code: Select all

[root@squid-lhr1 tmp]# (/root/mac > /tmp/mac 2>&1 &)


this method isnt make script file into the daemon. can u please give me one example how to make daemon?

Allah Hafiz[/code]
Image

  • Welcome In Red Hat Enterprise 4


Image
server
Naik
 
Posts: 83
Joined: Tue Jan 03, 2006 7:41 pm
Website: http://www.DecentNetwork.com
WLM: zeeshan@decentnetwork.com
Yahoo Messenger: shani_rago@yahoo.com
Location: Lahore

Postby lambda » Wed Dec 27, 2006 8:47 pm

server wrote:i tried but its not working
i can't login to your system and read the /tmp/mac file for errors. what makes you think it's not working properly?
can u please give me one example how to make daemon?
the example i gave you works. if it doesn't work for you, you'll have to explain what it does and what you expect it to do.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby server » Wed Dec 27, 2006 9:19 pm

ok im posting error
Last edited by server on Wed Dec 27, 2006 9:23 pm, edited 1 time in total.
Image

  • Welcome In Red Hat Enterprise 4


Image
server
Naik
 
Posts: 83
Joined: Tue Jan 03, 2006 7:41 pm
Website: http://www.DecentNetwork.com
WLM: zeeshan@decentnetwork.com
Yahoo Messenger: shani_rago@yahoo.com
Location: Lahore

Postby server » Wed Dec 27, 2006 9:21 pm

Assalam-o-Alykum!!
when i open my "vi /tmp/mac" there have i get this error

Code: Select all

Please Enter, Downlink & Uplink Speed in kbps and Select the Interface Name
You Type This Value DL-  UL-  Ethernet-
Cannot find device "root"
Error: Qdisc "10:1" is classless.
Unknown filter "10:0", hence option "protocol" is unparsable

well just tell me only 1 example, just like u make one script in daemon, then copy and paste that all codes, also what u type in ur script file :)
thanks
Allah Hafiz
Image

  • Welcome In Red Hat Enterprise 4


Image
server
Naik
 
Posts: 83
Joined: Tue Jan 03, 2006 7:41 pm
Website: http://www.DecentNetwork.com
WLM: zeeshan@decentnetwork.com
Yahoo Messenger: shani_rago@yahoo.com
Location: Lahore

Postby lambda » Thu Dec 28, 2006 12:00 am

server wrote:when i open my "vi /tmp/mac" there have i get this error

Code: Select all

Please Enter, Downlink & Uplink Speed in kbps and Select the Interface Name
You Type This Value DL-  UL-  Ethernet-
Cannot find device "root"
Error: Qdisc "10:1" is classless.
Unknown filter "10:0", hence option "protocol" is unparsable
why is that error there? does your script expect you to type something when it starts up?
well just tell me only 1 example, just like u make one script in daemon, then copy and paste that all codes, also what u type in ur script file :)
the problem here is most likely because your script or some program run by your script interacts with users. daemons run in the background, and do not generally interact directly with users. that's how almost all the daemons on your system work -- you don't have to type anything when your system starts up.

my example works for scripts. giving you a sample script and showing you how it runs as a daemon will not help you with your script.

if your script expects commands on startup, put the input, one on each line, in a file, and run it as

Code: Select all

(/root/mac < /root/input > /tmp/mac 2>&1 &)
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore


Return to “%s” Security

Who is online

Users browsing this forum: No registered users and 1 guest

cron