Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 21 Aug 2014, 12:13
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Pschedule 1.1.5 - Task on time
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 9 [130 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 7, 8, 9 Next
Author Message
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Fri 12 Sep 2008, 21:37    Post subject:  

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.
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Fri 12 Sep 2008, 23:00    Post subject:  

delete
_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile


Last edited by ttuuxxx on Sat 13 Sep 2008, 01:06; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Fri 12 Sep 2008, 23:13    Post subject:  

Thank you, ttuuxxx. I do so.
Back to top
View user's profile Send private message 
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Fri 12 Sep 2008, 23:20    Post subject:  

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?
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Sat 13 Sep 2008, 01:09    Post subject:  

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?


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"
lol
ttuuxxx

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5675
Location: Valåmoen, Norway

PostPosted: Sat 13 Sep 2008, 09:54    Post subject:  

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Sun 14 Sep 2008, 06:33    Post subject:  

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.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5675
Location: Valåmoen, Norway

PostPosted: Sun 14 Sep 2008, 06:49    Post subject:  

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Mon 15 Sep 2008, 08:30    Post subject:  

I modified as follows.

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

crond
#exec $CURRENTWM
==>
Code:
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:
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:
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.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5675
Location: Valåmoen, Norway

PostPosted: Mon 15 Sep 2008, 12:21    Post subject:  

Nice workaround. I check it out when I get a time-window.

Cron supports a crontab location in /etc/
Code:
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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Dougal


Joined: 19 Oct 2005
Posts: 2505
Location: Hell more grotesque than any medieval woodcut

PostPosted: Sat 20 Sep 2008, 07:33    Post subject:  

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).

_________________
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind
Back to top
View user's profile Send private message 
wagado

Joined: 23 Dec 2008
Posts: 3
Location: Pennsylvania

PostPosted: Tue 23 Dec 2008, 18:09    Post subject:  

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
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5675
Location: Valåmoen, Norway

PostPosted: Tue 23 Dec 2008, 18:36    Post subject:  

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Fri 26 Dec 2008, 06:01    Post subject:  

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:
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.
Back to top
View user's profile Send private message 
jake_take

Joined: 09 Jun 2008
Posts: 16
Location: Japan

PostPosted: Fri 26 Dec 2008, 06:42    Post subject:  

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:
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:
#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:
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:
 <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:
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:
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:
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:
#! /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.

Last edited by jake_take on Wed 13 May 2009, 18:58; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 9 [130 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 7, 8, 9 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1018s ][ Queries: 13 (0.0110s) ][ GZIP on ]