You are not logged in.
This script works when manually started, works when started by Xfce Application Autostart at boot, but stops part way through in a cron job:
#!/bin/sh
sleep 6s
killall -u $(id -nu) conky 2>/dev/null
cd "$HOME/.conky"
conky -q -c "$HOME/.conky/BL-Cal-mod3.conkyrc" &
cd "$HOME/.conky/MX-MyConky"
conky -q -c "$HOME/.conky/MX-MyConky/MySysInfoConky" &
exit 0
It kills the running conkys and quits.
MX Linux 21 Xfce version.
Offline
@ jeffreyC
Trim the fat a little:
#!/bin/sh
sleep 6
killall conky
conky -c $HOME/.conky/BL-Cal-mod3.conkyrc &
conky -c $HOME/.conky/MX-MyConky/MySysInfoConky &
exit 0
See if that works.
Question: Why wait 6 seconds?
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@ jeffreyC
Trim the fat a little:
#!/bin/sh sleep 6 killall conky conky -c $HOME/.conky/BL-Cal-mod3.conkyrc & conky -c $HOME/.conky/MX-MyConky/MySysInfoConky & exit 0
See if that works.
Question: Why wait 6 seconds?
The 6 second wait is for the desktop to come up before the conkys at boot.
Still would need the -q switches in the conky starts, otherwise the .xsession-errors adds a line every second which makes it grow and grow...
It wasn't so OCD in Stretch but Bullseye and Bookworm log everything.
Offline
OK, understood about -q
no idea why it doesn't finish in a cron job.
GUGL pointed out a few things:
There could be several reasons why a script scheduled in Crontab is not running. Here are some common issues you can check:
Check that the Crontab entry is correct. Make sure you have specified the correct path to the script and that the syntax is correct.
Don't use
$HOME
use
/home/username/
Check the permissions of the script. Ensure that the script has the correct permissions to be executed by the user running the Cron job.
Check the system time. Ensure that the system time is correct, as Cron relies on the system time to schedule jobs.
This looks interesting too:
Check the user's environment variables. Cron jobs do not run with the same environment variables as the user who scheduled the job. You may need to specify environment variables within the Crontab entry or within the script itself.
IF that's right try changing
conky -q -c $HOME/.conky/......
to
conky -q -c /home/username/.conky/BL-Cal-mod3.conkyrc &
Check the system logs. Check the system logs for any errors related to Cron or the script.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Might be something here: top reasons your cron job isnt running
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
So the script doesn't work with the -q switch?
But without the -q switch?
It just fills your .xsession-errors? And why a cron job?
Then kill this file that no one needs. There are several possibilities for that.
Offline
With your modified script (plus the -q switch) it still runs the killall part and then fails to start the conkys again.
If it was a script permission problem it would not run at all.
If the path to the script was not correct it would not run at all.
The same script runs all the way when started manually.
Last edited by jeffreyC (2023-10-21 06:22:35)
Offline
If the path to the script was not correct it would not run at all.
Did you change $HOME to /home/user_name like S11 suggested?
$HOME is correct for your user environment so the script will run to completion when you launch it manually. $HOME is not correct for a cron job (ambiguous). The script may be looking in /root as $HOME for the cron job.
You must unlearn what you have learned.
-- yoda
Offline
jeffreyC wrote:If the path to the script was not correct it would not run at all.
Did you change $HOME to /home/user_name like S11 suggested?
$HOME is correct for your user environment so the script will run to completion when you launch it manually. $HOME is not correct for a cron job (ambiguous). The script may be looking in /root as $HOME for the cron job.
Yes, I changed the path to the script.
Did not change the paths in the script to where the conkys were located, they were the parts that did not work, will try that.
Offline
PackRat wrote:jeffreyC wrote:If the path to the script was not correct it would not run at all.
Did you change $HOME to /home/user_name like S11 suggested?
$HOME is correct for your user environment so the script will run to completion when you launch it manually. $HOME is not correct for a cron job (ambiguous). The script may be looking in /root as $HOME for the cron job.
Yes, I changed the path to the script.
Did not change the paths in the script to where the conkys were located, they were the parts that did not work, will try that.
Still fails.
Offline
$HOME is correct for your user environment so the script will run to completion when you launch it manually. $HOME is not correct for a cron job (ambiguous). The script may be looking in /root as $HOME for the cron job.
You can use variables like $HOME in scripts managed by cron. If user PackRat is owner of the cronjob, the variabel will be expanded to /home/PackRat. If root is the owner, the expanded location will be /root.
Variables in scripts, saves a lot of typing... Do not stop using them...
// Regards rbh
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline
On my server, I have a cronjob starting att boot. The command has flag: " -logfile=$HOME/.config/..."". command ps -ef shows: " -logfile=/home/rbh/.config/..."
Just for the fun of it, I createed a cronjob for rbh. Running :
@hourly $HOME/tmp/printenv.sh
The script is:
===
#!/bin/sh
cd $HOME/tmp
printenv > printenv-from-cron.txt
===
I printed the environment from my bash and dash promt and compared with the environment from the cronjobb.
The cronjobs environment were more sparce than I had anticipated, but comon to them all was:
USER=rbh
HOME=/home/rbh
PWD=/home/rbh/tmp
The path is very sparce for the cronjobb:
"PATH=/usr/bin:/bin"
If you need to have path to $HOME/bin and $HOME/.local/bin, you have to expand the path in the script.
Last edited by rbh (2023-10-22 09:00:35)
// Regards rbh
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline
I tested running a user cronjobb from webmin.
Omited -q flag from script killing running conkys and starting new.
Webmin has an ouput window for the command.
I got message: "can't open display: ".
// Regards rbh
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline
I got message: "can't open display: ".
Worked when I added the below line as second line in the script:
export DISPLAY=:0.0
// Regards rbh
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline
If I do not have the -q switches in the conky-startup script it adds a line to the .xsession-errors every single second.
.xsession-errors logging is broken in recent Debian releases and they do not care to fix it.
https://salsa.debian.org/xorg-team/xorg … requests/7
Last edited by jeffreyC (2023-10-22 16:25:15)
Offline
If I do not have the -q switches in the conky-startup script it adds a line to the .xsession-errors every single second.
I omitted -q flagg just for debugging purpose...
Have you tried adding line "export DISPLAY=:0.0"?
// Regards rbh
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline
If I do not have the -q switches in the conky-startup script it adds a line to the .xsession-errors every single second.
.xsession-errors logging is broken in recent Debian releases and they do not care to fix it.
https://salsa.debian.org/xorg-team/xorg … requests/7
the soft way
Have logrotate trim weekly or daily and keep max. two versions
sudo nano -w /etc/logrotate.d/xsession
$HOME/.xsession-errors {
rotate 2
weekly
compress
missingok
notifempty
}
the hard tour
in autostart script
#!/bin/sh
if [ ! -h /home/user/.xsession-errors ]; then
rm /home/user/.xsession-errors
ln -s /dev/null /home/user/.xsession-errors
fi
user = jeffreyC
Offline