Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
I'm ruinning a program called freepops...What I want is for it to start whenever I log into my account...How would I do this? A shell script? If so, how do I write said script? All I need to do is run the command freepopsd -p2001 However, it must be run as root, even when I login as a different user. ANy help would be apperciated!
Thanks
-Tomas Novickas
Just add the path of the binary with arguments (/whereever/freepopsd -p2001) to your .bashrc or whatever shell you are using. Not sure if that will work but try.
That would run it as his user account, though, not as root. The program could be made SUID root, or if it needs to be run regularly, why not run it from cron?
cron's not what i need because the program only needs to be started once--when I log in or even when the ocmputer starts (that would be better, I think)
Put the command you need to run in a script, and copy the script into /etc/init.d. Make it executable by doing (as root):
Code:
chmod +x /etc/init.d/yourscript
I believe the first line of the script needs to be:
Code:
#!/sbin/runscript
for it to work this way. Anything in the /etc/init.d folder is executed when your computer boots up (I'm not sure if SuSE uses a different location; it might be /etc/rcS or something similar); you can run it manually just by typing /etc/init.d/yourscript from a root console.
the program needs to run as root to start properly--will this method do this? actually, i wasn't able to get the script to work:
ws116159:~ # /etc/init.d/freepopsstartup
bash: /etc/init.d/freepopsstartup: /sbin/runscript: bad interpreter: No such file or directory
Do you have an /sbin/runscript binary? The shebang (#!) is followed by the name of the interpreted to run the script, e.g. #!/bin/bash for a bash script. To make the program run as root, you'll need to set it SUID root, but the kernel will not honor the SUID bit on shell scripts. If it's in Perl you could use suidperl, otherwise you'll have to write a wrapper for it (this is a simple task), but I need to ask, what do you need to run as root at login time (as opposed to boot time or periodically). if you tell us what you're trying to do, maybe someone can suggest a better way to do it.
I saw on sourceforge.net (at least i think so) that there was a program that converts shell scripts to C code in which you then compile the C code to make an executable. Darn, forgot what it was called. I'll try looking for it...
actually, i'm trying to run it at boot time--i figured that would be the best. What I'm trying to run is a program called freepops. It checks various webmail services (gamil, aolmail, yahoo, etc) and turns it into POP3 so a normal email program can read it. I need it to start at boot time, as root, and I have to apss it certain paremeters (i.e. -p2001)
Thanks for any help!
-Tomas Novickas
apparently, and i quote:
n posix environments like Debian GNU/Linux you can start FreePOPs at boot time as a standard service. In this case the command line switches are stored in /etc/default/freepops, in some rpm based systems you should find the same file as /etc/sysconfig/freepops.
What does this mean? What is a standard service and how do I set it to start??? I think I understand the command line switches, though--I would jsut add my parameters to that file?
Thanks Again
-T
The startup scripts for services are stored in /etc/init.d or /etc/rc.d/init.d depending ondistro -- you can you chkconfig to activate a script to run at a particular runlevel (Debian uses runlevel 2 for multiuser mode, and many distros like SuSE use runlevel 3). If you don't want to mess with the runlevel scripts, you can just add the command to your rc.local (usually /etc/rc.local but SuSE might put it somewhere else).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.