Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Command_Monitor.sh not working properly as Cron Job #4316

Closed
Royel-Payne opened this issue Sep 23, 2023 · 11 comments
Closed

[Bug]: Command_Monitor.sh not working properly as Cron Job #4316

Royel-Payne opened this issue Sep 23, 2023 · 11 comments

Comments

@Royel-Payne
Copy link

User story

Command_Monitor not working properly as Cron Job after latest update

Game

Rust

Linux distro

Ubuntu 22.04, Ubuntu 20.04

Command

command: monitor

Further information

LGSM Monitor is no longer restarting game server after an update-lgsm was done on 9-17-23. This was working properly before a scheduled task to update-lgsm was done. (0 0 * * 0 /home/rustserver/rustserver update-lgsm > /dev/null 2>&1)

This is being run as a cron job. (*/5 * * * * /home/rustserver/rustserver monitor > /dev/null 2>&1)

When ran from CLI (./rustserver monitor) this functions as expected but when running as a Cron job this fails.

Log files are included

Relevant log output

Sep 22 17:40:03.430 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 17:40:04.437 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 17:40:04.447 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 17:40:04.449 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0
Sep 22 17:45:03.154 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 17:45:04.161 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 17:45:04.172 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 17:45:04.175 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0
Sep 22 17:50:02.892 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 17:50:03.899 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 17:50:03.912 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 17:50:03.915 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0
Sep 22 17:55:03.625 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 17:55:04.633 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 17:55:04.644 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 17:55:04.646 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0
Sep 22 18:00:03.377 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 18:00:04.385 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 18:00:04.396 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 18:00:04.399 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0
Sep 22 18:05:03.102 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 18:05:04.109 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 18:05:04.120 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 18:05:04.123 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0
Sep 22 18:10:02.873 rustserver: MONITOR: INFO: Checking installer: CHECKING
Sep 22 18:10:03.881 rustserver: MONITOR: PASS: Checking installer: LinuxGSM is installing
Sep 22 18:10:03.897 rustserver: MONITOR: INFO: LinuxGSM version: v23.5.2
Sep 22 18:10:03.900 rustserver: MONITOR: PASS: core_exit.sh exiting with code: 0

Steps to reproduce

  1. Run command_monitor.sh as Cron job
  2. Stop/Restart server from Rcon
  3. Wait for Cron job to run, server should be restarted but does not succeed
  4. View log files
@Royel-Payne Royel-Payne added the type: bug Something isn't working label Sep 23, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New Issues in LinuxGSM Backlog Sep 23, 2023
@Royel-Payne Royel-Payne changed the title [Bug]: [Bug]: Command_Monitor.sh not working properly as Cron Job Sep 23, 2023
@jonathan-robertson
Copy link

jonathan-robertson commented Sep 23, 2023

This is also happening to me; also using Ubuntu; hearing the version of Ubuntu does not seem to matter.

For what it's worth, I'm using LinuxGSM to manage 7 Days to Die.

@dgibbs64
Copy link
Member

Thanks for the info. I am reviewing a couple of bugs relating to monitor. I will try and replicate this as well

@Royel-Payne
Copy link
Author

Thanks!

Let me know if you need anything else, I'll be glad to provide more info if you need.

@TheBambino
Copy link

TheBambino commented Sep 23, 2023

I am also having this issue. Same OS. Latest update.

@aStonedPenguin
Copy link

Same problem with Debian 12

@dgibbs64
Copy link
Member

So this is a fun bug to identify. It appears to only happen with cron or watch. Bash appears to just stop running. I will continue doing tests until I find the issue. A hotfix will go out once fixed

@Royel-Payne
Copy link
Author

Royel-Payne commented Sep 25, 2023

Well I'm glad to hear it's fun! :)

Thanks for your time, I'm sure we all greatly appreciate the hard work you put into this project.

Good luck finding the solution. I'll keep my eye out for any updates.

@dgibbs64
Copy link
Member

Found the issue. cron uses a different environment to the default bash one (sh) and it is missing the $USER variable. So I added code to set the $USER variable if missing. Hopfully that should now fix the issue. Please update linuxgsm and let me know :)

@Royel-Payne
Copy link
Author

Thanks man, I'll update and let you know the results shortly.

@Royel-Payne
Copy link
Author

Tested and it looks to be working.

Thanks so much for getting this resolved.

@github-project-automation github-project-automation bot moved this from 🆕 New Issues to ✅ Done in LinuxGSM Backlog Sep 26, 2023
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

5 participants