Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

crontab

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
zoxovsky
Posts: 19
Joined: 2017-02-27 20:42

crontab

#1 Post by zoxovsky »

Hello,

How to configure crontab?

I want make a crontab to restart server game every day 6:00 AM this need to login specific user and make command ./server restart

user is ; game1

Please help me.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: crontab

#2 Post by milomak »

Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

zoxovsky
Posts: 19
Joined: 2017-02-27 20:42

Re: crontab

#3 Post by zoxovsky »

Ye but this doesnt work:/

I have this command right now and dont working.

06 1 * * * su - game1 -c /home/game1/game restart > /dev/null 2>&1

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: crontab

#4 Post by milomak »

have you tried running crontab as game1?

i am guessing you aren't seeing as you are using su? and i am also going to guess game1 needs a password?
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: crontab

#5 Post by Segfault »

Log in as user game1 and run crontab -e. Or use system crontab (where you can set user).

zoxovsky
Posts: 19
Joined: 2017-02-27 20:42

Re: crontab

#6 Post by zoxovsky »

milomak wrote:have you tried running crontab as game1?

i am guessing you aren't seeing as you are using su? and i am also going to guess game1 needs a password?
From root u dont need password for users.

User avatar
ralph.ronnquist
Posts: 342
Joined: 2015-12-19 01:07
Location: Melbourne, Australia
Been thanked: 6 times

Re: crontab

#7 Post by ralph.ronnquist »

Maybe it helps with a pair of double-quotes? As in:

Code: Select all

06 1 * * * su - game1 -c "/home/game1/game restart" > /dev/null 2>&1 

millpond
Posts: 698
Joined: 2014-06-25 04:56

Re: crontab

#8 Post by millpond »

Better yet put the calling commands in a shell script, make it executable - chmod 775, and have cron call the script. The permissions then could be changed as needed. may need to add the user to the game's group. or the other way around.

Post Reply