Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Maximum jimmies rustled

Name: op !!mYMwp093EuI2DM5 2012-12-23 14:59

Hiya /prog/. I hate to tarnish the board with this seemingly plebeian question, but I've been trying to solve this problem for days.

I wrote a script to do automated backups of a tekkit server I'm running on my home server. The script uses rcon to do a 5 minute countdown to warn players to get off, saves the map, shuts tekkit down, backs up meaningful data off site and is supposed to start tekkit again.

The only part that doesn't work is starting tekkit again. At least, it works if I launch the script manually, but not when launched as a cronjob.

Observe the failing portion:

update_timestamp
echo "$LOG_TIMESTAMP Attempting to re-launch server as user $SERVER_ACCT_USER."
cd $SERVER_ROOT
sudo -u $SERVER_ACCT_USER ./launch.sh
cd ~
update_timestamp
echo "$LOG_TIMESTAMP Routine done."


It is run as root but the script re-launches it under a limited user account. Again, works if I run the script manually but the cronjob works only up until this point and logs no errors.

The launch.sh script looks like this...


#!/bin/sh
# Launch tekkit. No hangup on server user disconnect.
# Detach from STDIN/STDIO or it will hang up the script.
nohup java -Xmx3G -Xms2G -jar Tekkit.jar nogui &> /dev/null < /dev/null &


Any ideas? I've run out.

Name: Anonymous 2012-12-23 15:16

sh scripting considered harmful
sudo considered harmful

Name: Anonymous 2012-12-23 15:22

>>2

>Doing anything more involved for a minecraft server.
>Thinking a use of su or sudo is significantly different when changing users from root to a limited account.

I don't see the problem.

Name: Anonymous 2012-12-23 15:45

sudo
Why not just use su?

Name: Anonymous 2012-12-23 15:47

>>4

Because in this instance, they do the same thing.

Name: Anonymous 2012-12-23 17:46

>>5
Then use su. Not every user has sudo.

Name: Anonymous 2012-12-23 17:49

                                       `
>mfw neither su nor sudo are in POSIX


how the HELL are people supposed to switch user especially on terminals that only support a single console

Name: Anonymous 2012-12-23 18:10

>>7
XDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD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DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD


>MFW MY FACE WHEN LELELELLLELEELELE E/G/IN /G/ENTOO LELLL
>E/G/IN WIN /G/RO U TROLED THEM HARDDDDDDD

Name: Anonymous 2012-12-23 18:26

>>6

But I'm not writing it for 'every user'

I'm writing it for my own server. If it'll make everyone chill, I'll try su instead.

>>8

Okay then.

Name: Anonymous 2012-12-23 18:42

>>8
LELELELLLLLLLLLLLLL LE SHOTGUN RETARD BEING RANDUM AGAIN

Name: Anonymous 2012-12-23 19:12

I changed the line with sudo to this and it made no difference.


su $SERVER_ACCT_USER -c '$SERVER_ROOT/launch.sh'


Log still turned up clean of any kind of errors.

Name: Anonymous 2012-12-23 19:20

>>10
fuck you cretin

Name: James Gosling 2013-04-07 5:13

GAWWZMACS FLABBERGASTS MY AUDIENCE

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List