You are not logged in.

#1 2019-01-03 16:03:38

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,694
Website

cronie and systemd commands

Happy New Year everyone!!
I have a question: are there any special rules one has to follow when using systemd commands via cron?

I run KDE on an up-to-date system.
I have a script in $HOME/bin that should automatically log off my workstation at the end of the day but it does not.

The script works as expected if I do "~/bin/dayend" but it will not run via cron.

The code in question:

#!/bin/bash
loginctl lock-session


Thanks for any ideas.

Offline

#2 2019-01-04 23:46:39

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,694
Website

Re: cronie and systemd commands

This turned out to be interesting.
It seems that if I run:

pkill -KILL -u ralvez

I'm OK. It runs just fine.
But ... if I run loginctl which is also in /usr/bin/ it refuses to do it.

Now, of course, I would prefer not to use pkill over loginctl because the former kills not only the session but all processes therein.
If someone has an idea to accomplish the task I'll be happy to hear it. smile

R.

NOTE: To say "it resuses to do it" is not accurate. Actually it just fails silently I have no grounds to say that it "refuses" to run as a cron command.

Last edited by ralvez (2019-01-04 23:49:25)

Offline

Board footer

Powered by FluxBB