BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsBSD Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 24th, 2001, 10:44 AM
d0g1e d0g1e is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: The Netherlands
Posts: 8 d0g1e User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to d0g1e
high priority scripts at startup

Main question:
How do I make a program run as root at startup?

I've got a perl script, that runs in the background. I usually start it as root, because the script will run another program with the highest priority (nice --20), so I'll need to run as root. Now I want this script to go into the background at startup. I did this, but the nice --20 won't work, because the script doesn't run as root...


Thanks in advance,

d0g1e@cyberspace.org

Reply With Quote
  #2  
Old November 24th, 2001, 03:40 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
1) Which BSD? All 3 uses different rc mechanism.
2) What does your script do?
3) What are the dependencies your script needs?

Reply With Quote
  #3  
Old November 24th, 2001, 04:16 PM
d0g1e d0g1e is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: The Netherlands
Posts: 8 d0g1e User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to d0g1e
I'm using FreeBSD

The script is a perl script. It reads a queue every two seconds and, if a new mp3 has been added, it will play the mp3 using mpg123.

the command is something like:

system("nice --20 mpg123 $mp3Filename &");

I want it to run at top priority, because the server is a pentium 60 with 16 megs of ram, and it doubles as a small webserver. I wan't to prevent hick-ups in the mp3 playback, when people flood the webserver with requests. (I already reconfigured apache, but I'm not going to allow less clients, I've already reached the minimum for my environment)

Reply With Quote
  #4  
Old November 24th, 2001, 04:27 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Put your script to /usr/local/etc/rc.d/ directory. At the minimum, your script should expect two args: start and stop, so it can start/stop properly.

Check out http://www.perl.com/CPAN-local/modu...-module/Getopt/

How to code your script is beyond the scope in BSDs forum.

If you are talking about startup priority, FreeBSD has a poor mechanism for local scripts. It will look for your script name in the order of 0-9, then A-Z, then a-z.

Last edited by freebsd : November 24th, 2001 at 04:30 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > high priority scripts at startup

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap