Pschedule 1.1.6 - Task on time
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.
Thank you.
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.
Thank you.
- ttuuxxx
- Posts: 11171
- Joined: Sat 05 May 2007, 10:00
- Location: Ontario Canada,Sydney Australia
- Contact:
delete
Last edited by ttuuxxx on Sat 13 Sep 2008, 05:06, edited 1 time in total.
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)
- ttuuxxx
- Posts: 11171
- Joined: Sat 05 May 2007, 10:00
- Location: Ontario Canada,Sydney Australia
- Contact:
Sorry Jake I have the flu, Heatstroke, and a couple of pulled chest muscles, I'm on a lot of meds, A bit fuzzy. My mistake, I bet it made you feel like you were on the "Twilight Zone"jake_take wrote:Hi,ttuuxxx, again. I'm very confused. The link you wrote is here!
I was returned to the same thread. Is this Pschedule thread? or not?
lol
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)
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.
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.
I modified as follows.
1) the tail part of /root/.xinitrc,
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
==>
("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
==>
("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.
1) the tail part of /root/.xinitrc,
crond
#exec $CURRENTWM
==>
Code: Select all
cp -r -f /etc/crontabs /var/spool/cron
crond
#exec $CURRENTWM
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
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
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.
Nice workaround. I check it out when I get a time-window.
Cron supports a crontab location in /etc/
Taken from 'man cron'. I will try to use this by default.
Sigmund
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))
Sigmund
- Dougal
- Posts: 2502
- Joined: Wed 19 Oct 2005, 13:06
- Location: Hell more grotesque than any medieval woodcut
I think /var might be the correct place for cron files...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.
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).
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Some say your nose
Some say your toes
But I think it's your mind
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
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
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.
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.
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
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)("N=1" inserted)
and
(line 102 to line 109)
("$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.
The second step is to modify the pschedule main file (pschedule).
"2" ==> "0" in line 85
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
==>
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.
And func_run is as follows.
I checked this modified pschedule and have no troubles so far.
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"`
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
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...
"2" ==> "0" in line 85
Code: Select all
<tree rules_hint=\"true\" exported_column=\"2\">
==> <tree rules_hint=\"true\" exported_column=\"0\">
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
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
Last edited by jake_take on Wed 13 May 2009, 22:58, edited 1 time in total.
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,
("BBC news" is the task name in this case)
And edit func_cron_to_human file as follows.
(line 22, the difinition of $COMMAND)
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.
Code: Select all
gxine http://www.bbc.co.uk/worldservice/ram/live_infent.ram #BBC news
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`
I hope the future version of Pschedule has a task-names entry in addition to the conventional command entry.
Multiple crond
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
echo "killall -q crond; crond" >> $HOME/.xinitrc
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.
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.