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

 

 

 

[Solved] cron.daily doesn't raise xterm

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

[Solved] cron.daily doesn't raise xterm

#1 Post by bester69 »

Its running the script as log files are being completed, but it doent opent a xterm terminal, neither a konsole terminal. When I use run-parts for testing it, It does open the terminals... :?: :?:

Code: Select all

#!/bin/sh
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
fechaname=hardback-`date +%Y-%m-%d_%H:%M:%S`.log
su myuser -c "/home/myuser/scripts/hardback.sh" | tee /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname
su myuser -c "konsole --hold -e more /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname"
su myuser -c "xterm -hold -e more /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname"
Any help? :( , Thanks
Last edited by bester69 on 2018-06-22 10:21, edited 1 time in total.
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: cron.daily doesn't raise xterm

#2 Post by bw123 »

man su will explain the env that gets preserved under different circumstances. Also there are a lot of results with this
https://duckduckgo.com/html/?q=cron+open+terminal
resigned by AI ChatGPT

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: cron.daily doesn't raise xterm

#3 Post by reinob »

bester69 wrote:Its running the script as log files are being completed, but it doent opent a xterm terminal, neither a konsole terminal. When I use run-parts for testing it, It does open the terminals... :?: :?:

Code: Select all

#!/bin/sh
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
fechaname=hardback-`date +%Y-%m-%d_%H:%M:%S`.log
su myuser -c "/home/myuser/scripts/hardback.sh" | tee /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname
su myuser -c "konsole --hold -e more /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname"
su myuser -c "xterm -hold -e more /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname"
Any help? :( , Thanks
Well cron.daily runs as root so I don't know how you expect that to work (hint: imagine nobody is logged in, where should xterm show up?).

cron is not (designed) for interactive things. If you really insist in (ab)using it for that purpose, use at least the user's cron, so that you don't need the "su myuser -c".

Note also that before konsole or xterm can do anything graphical they need to know where they are supposed to show up, i.e. at the very least you should set the DISPLAY environment variable to something sensible.

On top you have the whole session/dbus/pam/systemd/policykit mess to deal with. But first things first.. (it won't work anyway).

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: cron.daily doesn't raise xterm

#4 Post by bester69 »

reinob wrote: Well cron.daily runs as root so I don't know how you expect that to work (hint: imagine nobody is logged in, where should xterm show up?).

cron is not (designed) for interactive things. If you really insist in (ab)using it for that purpose, use at least the user's cron, so that you don't need the "su myuser -c".

Note also that before konsole or xterm can do anything graphical they need to know where they are supposed to show up, i.e. at the very least you should set the DISPLAY environment variable to something sensible.

On top you have the whole session/dbus/pam/systemd/policykit mess to deal with. But first things first.. (it won't work anyway).
Thanks for answering, I think DISPLAY environment will work, It had already triggered xterm and konsole in a test script.

Code: Select all

DISPLAY=:0 ; export DISPLAY
su myuser -c "xterm -display :0 -hold -e ls"
su myuser -c "konsole --hold -e ls"

Thanks again, I really apreciate it :)
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: cron.daily doesn't raise xterm

#5 Post by Head_on_a_Stick »

A systemd timer unit enabled for the user would be better suited to this, see systemd.timer(5) for the details.
deadbang

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: cron.daily doesn't raise xterm

#6 Post by bester69 »

Head_on_a_Stick wrote:A systemd timer unit enabled for the user would be better suited to this, see systemd.timer(5) for the details.
Thanks Head,
I will take it a look , by now it's working old way

Code: Select all

#!/bin/sh
################# HARDLINKS SDA3
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
fechaname=hardback-SDA3`date +%Y-%m-%d_%H:%M:%S`.log
su myuser -c "/home/myuser/scripts/hardback_SDA3.sh" | tee /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname

DISPLAY=:0 ; export DISPLAY
su myuser -c "konsole -e more  /home/myuser/LINUXDEBS/NOBACKUP/logs/$fechaname"

exit 0
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply