Page 2 of 8

Posted: Sat 13 Sep 2008, 13:54
by zigbert
I have tested Pschedule 0.6 in Puppy 4.1 beta, and everything seems fine. /var/spool/cron/crontabs/root/ are not deleted after reboot. I remember there were some discussion over including /var/ or not, so maybe you're just unlucky with your Puppy version.

Sigmund

Posted: Sun 14 Sep 2008, 10:33
by jake_take
I boot Puppy from USB, so I guess this trouble may be occured.
In frugal install I recognized the Pschedule data is saved and not deleted. I have not tested Puppy 4.1beta, but both scripts of /etc/rc.d/rc.shutdown and /usr/sbin/snapmergepuppy don't seem to be changed from Puppy 4.02 or from Puppy 4.00 (k-2.6.21.7), so I guess the difference of booting method make this problem.

Posted: Sun 14 Sep 2008, 10:49
by zigbert
jake_take
Ok, I see.... This is already on my wish-list for Pscedule, since /etc seems to be the crontab standard out there. But it has not that high priority, so it will not be fixed in the near future. Sorry!

Sigmund

Posted: Mon 15 Sep 2008, 12:30
by jake_take
I modified as follows.

1) the tail part of /root/.xinitrc,

crond
#exec $CURRENTWM
==>

Code: Select all

cp -r -f /etc/crontabs /var/spool/cron
crond
#exec $CURRENTWM
("cp -r -f /etc/crontabs /var/spool/cron" added before "crond")

2) line 143 of /usr/local/pschedule/func_new,

killall -q crond; crond #restart cron
==>

Code: Select all

cp -r -f /var/spool/cron/crontabs /etc
killall -q crond; crond #restart cron
("cp -r -f /var/spool/cron/crontabs /etc" added before "killall -q crond; crond")

3) line 31 of /usr/local/pschedule/func_delete,

killall -q crond; crond #restart cron
==>

Code: Select all

cp -r -f /var/spool/cron/crontabs /etc
killall -q crond; crond #restart cron
("cp -r -f /var/spool/cron/crontabs /etc" added before "killall -q crond; crond")

The Task Command is saved in /etc as well as in /var/spool/cron.... After reboot, it is copied to /var/spoolcron... and automatically executed.

Posted: Mon 15 Sep 2008, 16:21
by zigbert
Nice workaround. I check it out when I get a time-window.

Cron supports a crontab location in /etc/

Code: Select all

Cron searches /var/spool/cron for crontab files which are named after accounts in crontabs found are loaded into memory. Cron also searches for /etc/crontab and the files in the directory, which are in a different format (see crontab(5))
Taken from 'man cron'. I will try to use this by default.

Sigmund

Posted: Sat 20 Sep 2008, 11:33
by Dougal
jake_take wrote:I wonder why Pschedule data should be saved in /var/spool/cron/crontabs? Why not in /etc, for example? No files in /var is saved in pup_save, and the data in /var/spool/cron/crontabs is evaporated in next boot. So I must write the same task schedule in every boot.

To avoid this , I modified Pschedule files so that Pschedule data is saved in /etc and loaded there. But this is not easy for any begginers.
I think /var might be the correct place for cron files...
Rather than modifying Pschedule, I'd get Barry to fix /usr/sbin/snapmergepuppy (the script that saves the files when running from flash media) so it doesn't ignore /var, since I don't think it should (I changed it a while ago, since I had some other problems as a result of /var not being saved).

Posted: Tue 23 Dec 2008, 22:09
by wagado
I'm looking for help in using Pschedule to run a script I created.

I put the script in pschedule and select that it run every morning at 7:50, then click on the run button in pschedule xwin locks up.

Is it necessary to click the run button in pschedule for the script to run. Any idea why xwin locks up? Pschedule apears to be running because the script runs on time, but if I ctrl-alt-backspace and run xwin again I don't know if it is still running.

Thanks

Posted: Tue 23 Dec 2008, 22:36
by zigbert
The 'Run' button is for starting scheduled commands (programs) manually. Everything listed in main window is running. Why its lock is hard to tell without investing the script.

Test it easy with setting the time-stamp 2 minutes in the future. Wait and see....


Sigmund

Posted: Fri 26 Dec 2008, 10:01
by jake_take
This might be another bug. If you have some tasks all of which have a same command and you delete one of these, you will find all these tasks deleted. For example, you have 5 tasks in order to listen to BBC news every 3 hours, i.e. gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram at 6:00, 9:00, 12:00, 15:00 and 18:00. Cron commands should be like this.

Code: Select all

0 6 * * * gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram
0 9 * * * gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram
0 12 * * * gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram
0 15 * * * gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram
0 18 * * * gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram
But 6:00 is too early, so you want to delete this task (0 6 * * * gxine http://www.bbc.co.uk.....). And you delete it by Pschedule's dialog, but the other 4 tasks shall be also deleted simultaneously.

Posted: Fri 26 Dec 2008, 10:42
by jake_take
To avoid the above phenomenon I edited pschedule's files as follows. Of course there may be another smarter way.
The first step of this method is to number the line of /tmp/pschedule-treeitems. So the file of func_cron_to_human is modifyed like this.

(from line 9 to line 15)

Code: Select all

else
	echo -e "\c" > /tmp/pschedule-treeitems
	cat /var/spool/cron/crontabs/$USER | sed -e "s/ /{\u00f0\u00aeSSS\u0111\u00fe}/g" | sed -e "s/*/{\u00f0\u00aeSTAR\u0111\u00fe}/g" > /tmp/pschedule-forloop
fi
N=1 #jake_take added                <==
for I in `cat /tmp/pschedule-forloop`; do
	I=`echo "$I" | sed -e 's/{ð®SSSđþ}/ /g'` #used later to check for advanced cron
	CRONCOMMAND=`echo "$I" | sed -e "s/{ð®STARđþ}/*/g"`
("N=1" inserted)
and
(line 102 to line 109)

Code: Select all

#if cron contains , / - will it be set to 'Advanced schedule'
	if [ "`echo "$I" | cut -d " " -f 1-5 | grep '/'`" ] || [ "`echo "$I" | cut -d " " -f 1-5 | grep ','`" ] || [ "`echo "$I" | cut -d " " -f 1-5 | grep '-'`" ]; then
		echo "$N:$COMMAND | Advanced schedule | $CRONCOMMAND" >> /tmp/pschedule-treeitems # for main window #jake_take added "$N:"
	else
		echo "$N:$COMMAND | $MONTH$DAY$WEEKDAY$HOUR$PREDAY$TIME_DELIMINATOR$MINUTE | $CRONCOMMAND" >> /tmp/pschedule-treeitems # for main window
	fi
	N=`expr $N + 1` #jake_take added
done
("$N:" added in line 104 and 106, and line 108 "N=`expr $N + 1`" added)

By this modification, we get the following /tmp/pschedule-treeitems.

Code: Select all

1:gxine .. | 6:00 | 0 6 * * * gxine...
2:gxine .. | 9:00 | 0 9 * * * gxine...
3:gxine .. | 12:00 | 0 12 * * * gxine...
4:gxine .. | 15:00 | 0 15 * * * gxine...
5:gxine .. | 18:00 | 0 18 * * * gxine...
The second step is to modify the pschedule main file (pschedule).
"2" ==> "0" in line 85

Code: Select all

 <tree rules_hint=\"true\" exported_column=\"2\">
==>   <tree rules_hint=\"true\" exported_column=\"0\">
Fot this modification, the variable, $TREE, becomes the first column of the selected line ("2:gxine", for exapmle), not the third column ("0 9 * * * gxine...).

The third step is to modify the func_delete file.
The line 28-30 is changed as follows

Code: Select all

if [ "$EXIT" = "yes" ]; then
	TMP=`echo "$TREE" | cut -d " " -f 6-`
	cat /var/spool/cron/crontabs/$USER | grep -wv "$TMP" | grep -v "^$" > /var/spool/cron/crontabs/$USER
==>

Code: Select all

if [ "$EXIT" = "yes" ]; then
	NUM=`echo $TREE | cut -d ":" -f 1` #jake_take, $NUM is 1st part of $TREE 
	sed -i -e "${NUM},${NUM}d" /var/spool/cron/crontabs/$USER #jake_take, the selected line of cron command is deleted
The new variable, $NUM, is the number of the selected line in treeitems and the number of the line
of cron commands, which is to be deleted.
As I menioned above, the variable, $TREE, is not the same as of original, So $TREE must be changed. The line 153-155 of func_new is modified as follows.

Code: Select all

else
		TREE=`cat /tmp/pschedule-treeitems | grep $TREE | cut -d "|" -f 3 | cut -c 2-` #jake_take
		edit #generate lists of cron command
		new

And func_run is as follows.

Code: Select all

#! /bin/bash
TREE=`cat /tmp/pschedule-treeitems | grep $TREE | cut -d "|" -f 3 | cut -c 2-` #jake_take
COMMAND=`echo "$TREE" | cut -d " " -f 6-`
echo "$COMMAND" > /tmp/pschedule-run
chmod 777 /tmp/pschedule-run
/tmp/pschedule-run
I checked this modified pschedule and have no troubles so far.

Posted: Fri 26 Dec 2008, 12:31
by jake_take
In Pschedule main window the tasks are shown in commands and time, so we must edit or delete by judging from commands and time. It may cause mistakes. If you want to see the task name in the main window, in stead of command-lines, you should enter the commands with "#" followed by task names. For example,

Code: Select all

gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram #BBC news
("BBC news" is the task name in this case)
And edit func_cron_to_human file as follows.
(line 22, the difinition of $COMMAND)

Code: Select all

COMMAND=`echo "$CRONCOMMAND" | cut -d " " -f 6- | cut -d "#" -f 2`
You will see the task name ("BBC news") in main window.
I hope the future version of Pschedule has a task-names entry in addition to the conventional command entry.

Posted: Sat 27 Dec 2008, 09:01
by zigbert
jake_take
Thanks for your input!!!!!!

I have to deal with this later. There are just so many balls in the air right now.


Sigmund

Multiple crond

Posted: Sat 16 May 2009, 12:08
by jake_take
If you restart X in a session, you will find 2 "cronds" running. One is of before restarting X, and another is of after restarting. This bug is caused by the command line "crond" in /root/.xinitrc. To fix this, this part in /root/.xinitrc should be "killall -q crond; crond" and the line 24 in /usr/local/pschedule/pschedule should be modified as below.

echo "killall -q crond; crond" >> $HOME/.xinitrc

Posted: Sat 16 May 2009, 12:54
by zigbert
jake_take
I think we better make a cron-check-script in /root/Startup like the one in Pbackup.


Sigmund

Posted: Thu 21 May 2009, 17:17
by zigbert
Version 0.7
See main post

jake_take
has improved the general handling of tasks.
Many thanks for his effort.


Changelog
- Give each task a nr./name. (thanks to jake_take)
- Do not center windows on screen.
- The 'next run' entry in add-task-window is now visible.
- Bugfix: Delete only selected task if similar command. (thanks to jake_take)
- Bugfix: Avoid several instances of cron. (thanks to jake_take)
- Bugfix: Thursday failed in cron-builder-window.

Posted: Thu 31 Dec 2009, 10:11
by zigbert
Version 0.8
See main post

- start pschedule with predefined task from terminal. (thanks to mcewanw)

Pschedule -h for usage.

unable to pass embedded paths or filenames containing spaces

Posted: Fri 01 Jan 2010, 13:37
by mcewanw
Thank you for updating Pschedule.

Unfortunately, whilst now modifying precord to utilise the new facility, I have come across a small but critical error which prevents the passing of commands or tasknames which contain embedded quotes, and/or paths or filenames which contain spaces or multiple spaces of various lengths.

For example, I need to be able to pass a command such as:

Code: Select all

precord "rec '$DIR1FILE'"
where DIR1FILE contains a path/filename which may contain spaces or multiple connected spaces. In the Pschedule "Command" window, the result should of course end up being:

precord rec 'what the path filename is including any spacesand the surrounding quotes'

To fix the problem the following two small changes are required in func_new:

line 59:

Code: Select all

Change:

<entry><variable>TASK</variable><input>echo $TASK</input></entry>

to:

<entry><variable>TASK</variable><input>echo \"$TASK\"</input></entry>
line 63:

Code: Select all

Change:

   <entry><variable>TASKNAME</variable><input>echo $TASKNAME</input></entry>

to:

<entry><variable>TASKNAME</variable><input>echo \"$TASKNAME\"</input></entry>

Posted: Fri 01 Jan 2010, 14:10
by zigbert
mcewanw
Fixed in 0.8-1
Thank you


Sigmund

Posted: Sat 06 Mar 2010, 22:10
by disciple
It would be nice if there was a button to enable/disable a task. I think this can be done just by commenting it with a # in the crontab, although making the gui handle the disabled tasks would be a bit more difficult :)

Posted: Tue 13 Jul 2010, 05:34
by smokey01
Zigbert is there any way to start a program like ffmpeg at a predetermined time then stop it at a later predetermined time.

I would like to use Pschedule with ffmpeg to record shows on TV.

I assume you would setup a second cron job but how do you reference the original terminal window and job?