Four Js Development Tools Forum

General => General Discussion => Topic started by: IT D. on August 27, 2024, 10:45:42 pm



Title: flmprg runnig as cron job creates empty output
Post by: IT D. on August 27, 2024, 10:45:42 pm
I have a very small script that runs the following command and emails the resulting output to me.

flmprg -a info users > /home/tmp/users.log

When run manually from command line, this produces a simple text file of all currently logged in users utilizing a license. 

When same command is run from a cron job, output is always blank, regardless of user executing cron.  All users have write permission on output file. 

Suggestions?


Title: Re: flmprg runnig as cron job creates empty output
Post by: Roland W. on August 28, 2024, 01:20:29 pm
Hi,

maybe your environment is missing. Have you tried to use
Code:
bash -l
(see https://stackoverflow.com/a/51591762 (https://stackoverflow.com/a/51591762)) to run your command?
This tutorial https://www.baeldung.com/linux/load-env-variables-in-cron-job (https://www.baeldung.com/linux/load-env-variables-in-cron-job) may also be interesting about to properly set the environment in cron jobs.

Kind regards
Roland