Find the answer to your Linux question:
Results 1 to 5 of 5
OS: Ubuntu Server 10.04.2 LTS Hi, I have a problem, I have a script which need to be ran in a screen, automaticly at startup (SRCDS Spesificly). What I've done: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    6

    Run script in screen at startup


    OS: Ubuntu Server 10.04.2 LTS

    Hi, I have a problem, I have a script which need to be ran in a screen, automaticly at startup (SRCDS Spesificly).

    What I've done:
    Ive placed a boot.sh script in init.d:
    Code:
    sh /home/xinity/eXtremeServer/startup.sh
    startup.sh:
    Code:
    cd /home/xinity/eXtremeServer
    screen -S Sandbox ./orangebox/StartServer.sh
    Code:
    cd /home/xinity/eXtremeServer/orangebox/
    #cp -v ./srcds_run_cp ./srcds_run
    #chmod -v +x ./srcds_run
    ./srcds_run -console -game garrysmod +hostport 27016 +tv_port 27021 +maxplayers 16 +map gm_construct -autoupdate -insecure -consolelog ./conlog.txt -timeout 1 -ignoresigint
    Ran update-rc.d

    What is wrong/happens:
    The server will run, I can connect to it, and see its process in top (running as root though). But it will not appear in the screen -ls list. And I cannot attach to it, therefor I have no way to manage my screen/server.

    Is there any other way to execute scripts at startup? I remember when I ran Ubuntu Desktop, I managed to run it by the program Startup Manager. There has to be an nongui way to do this?

    Thanks for any answer

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Have you tried detaching the screen?
    Code:
    screen -S Sandbox -d -m ./orangebox/StartServer.sh
    You mention "running as root" - is it not supposed to run as root? Anyway, whomever is the user that calls screen is the one that controls the screen, so "screen -ls" will only work as that user that started the screen.

  3. #3
    Just Joined!
    Join Date
    Nov 2010
    Posts
    6
    Quote Originally Posted by atreyu View Post
    Have you tried detaching the screen?
    Code:
    screen -S Sandbox -d -m ./orangebox/StartServer.sh
    You mention "running as root" - is it not supposed to run as root? Anyway, whomever is the user that calls screen is the one that controls the screen, so "screen -ls" will only work as that user that started the screen.
    Yeah you're right, sudo screen -ls showed my screen.
    Its supposed to run under my main user (xinity). As screen messes up when its ran under root. I tried sudo -u xinity, but then the server failed to run :/

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    As screen messes up when its ran under root. I tried sudo -u xinity, but then the server failed to run :/
    can you explain what you mean by the screen messing up, when root?

    also, what do you mean the server fails to run; because your main user simply can't run the server (permission problems, etc.) or b/c of the way you are invoking sudo? attach errors, if possible.

  6. #5
    Just Joined!
    Join Date
    Nov 2010
    Posts
    6
    Quote Originally Posted by atreyu View Post
    can you explain what you mean by the screen messing up, when root?

    also, what do you mean the server fails to run; because your main user simply can't run the server (permission problems, etc.) or b/c of the way you are invoking sudo? attach errors, if possible.
    With screen "messing up", I mean it won't accept input and often hangs. With "Server fails to run" I mean nothing happens, no process in top, no screen in -ls.
    And there are no errors :/

    Thanks

Posting Permissions

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