autorun at startup


Results 1 to 6 of 6

Thread: autorun at startup

  1. #1
    Join Date
    Sep 2000
    Location
    Park Ridge,IL,60068
    Posts
    59

    autorun at startup

    I would have looked for the info in posts before this one, but I don't remember any of the commands or keywords...

    Anyway I need to run two things when my linux box starts up, one is a script, and the other is a perl file. I need to run both of them as something other than root.

    Do you know how to set this up?

    Thanks for any help!

  2. #2
    Join Date
    Sep 2001
    Posts
    177
    On my system (debian) you can do this with 'start-stop-daemon'. See if it comes on your system, and check out the man page if so.

  3. #3
    Join Date
    Sep 2000
    Location
    Park Ridge,IL,60068
    Posts
    59
    I am trying to run this on either a red hat system, or a mandrake system.

  4. #4
    Join Date
    Oct 2001
    Posts
    502
    Is it possible to run the scripts with suid your uid? I've never tried it, but it might be worth checking.

    Just out of curiosity, if you don't mind sharing, why would you need to run something at startup as a user other than root. I've heard this question before, and I don't really get the reasoning. If it's run at startup, it usually has something to do with configuration, starting services, etc. But users can't do much with that. But if it's not something like that, then why are you running it at startup, instead of, say, at login time? Maybe I'm missing something.

  5. #5
    Join Date
    Sep 2000
    Location
    Park Ridge,IL,60068
    Posts
    59
    well... I am running a game server, and if there is a power outage, I would like the script to kick in right after the computer boots back up. Also just incase I ever have to restart the server it is nice to have it start up automatically.

    Another reason, is that I am also running a stats program, and it also has to be started during the startup

    I know about the su command, but I don't know how I would do something like that.

  6. #6
    Join Date
    Oct 2001
    Posts
    502
    Okay, I guess that's a good reason. I would have thought you'd want to run servers as root, but I've never done it, so what do I know?

    Anyway, I was talking about the suid (set user ID) bit on a file's permissions, not the su command (although that would work, but isn't good for boot time). I checked the man page for chmod, and it had some information on it. Apparently, if the setuid bit is set, then the program will run with the permissions of the owner, rather than the permissions of whoever runs it. The following should do the trick:
    chmod a+s <filename>
    You can also do it by using a 4 before the 3 digit octal permissions, e.g.
    chmod 4755 <filename>

    I really have no idea whether or not that would be appropriate for what you're trying to do, but I just thought I'd put it out there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •