LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Crontab Not working appropriate? (https://www.linuxquestions.org/questions/linux-software-2/crontab-not-working-appropriate-455245/)

roclok 06-15-2006 09:59 PM

Crontab Not working appropriate?
 
I created two scripts. One for opening an image with kuickshow, the other for powering off computer.


my_picture script contains:
Code:

#!/bin/bash
# Warning to Shutdown

kuickshow '/home/bdd86/Documents/goodnight.gif'

my_poweroff script contains:
Code:

#!/bin/bash
# Poweroff now

poweroff


Crontab -e
Code:

53 22 * * * '/home/bdd86/Documents/my_picture'
54 22 * * * '/home/bdd86/Documents/my_poweroff'

Nothing happens at 10:53.... my_picture does not run... but a minute later my_poweroff runs perfect.

When I run ./my_picture in konsole it opens fine. but Crontab just doesnt seem to run it at all?

How can I get crontab to open a picture in kuickshow?

THank you!

kaz2100 06-15-2006 10:06 PM

permission??

roclok 06-15-2006 10:13 PM

No I ran chmod 755 my_script and when i do ./my_script it works perfect... Crontab just wont run it???????

kencaz 06-15-2006 10:15 PM

kuickshow is an X application which crontab cannot handle.

KC

roclok 06-15-2006 10:19 PM

Ok, how can I make a script Open up a Konsole, with pre-written text in it, saying You have 30 Minutes until computer power off?

kencaz 06-15-2006 10:36 PM

try adding DISPLAY=:0 to the begining of your crontab file...

KC

roclok 06-15-2006 11:01 PM

No this didn't work, heres my crontab file

Code:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.6299 installed on Fri Jun 16 00:00:21 2006)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
DISPLAY=:0
01 01  * * * '/home/bdd86/Documents/my_script'
50 23 * * * '/home/bdd86/Documents/my_poweroff'


kencaz 06-15-2006 11:25 PM

Try adding the line directly to crontab using "crontab -e". A script is not required in most cases.

DISPLAY=:0
00 21 * * Mon-Fri kuickshow /home/bdd86/Documents/goodnight.gif

This works fine for me... Test it and see...

KC

homey 06-15-2006 11:31 PM

Have you considered the shutdown command? It can be scheduled and gives a warning to logged in users one minute in advance.
Needs to be run by the root user...
For example:
Code:

sudo shutdown 00:35

or

su - -c "shutdown 00:35"

More options from man shutdown

roclok 06-15-2006 11:34 PM

Kencaz, for some reason, that worked PErfectly that time. I think i was using "'"s in the wrong place. THanks alot, My Notice system for my g/f's sister to get off my computer Is Working, and poweroff works perfectly 1 minutes later. Thanks dude :)!!!!!!!!!


All times are GMT -5. The time now is 09:52 AM.