Pschedule 1.1.6 - Task on time

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#106 Post by zigbert »

don570 wrote:Shinobar puts the following code in his apps.
I have been doing the same recently.
It allows the scripts to run on more distributions

Code: Select all


for P in gtkdialog4 gtkdialog3 gtkdialog; do
    GTKDIALOG=$(which $P) && break
  done
  
________________________________________
Yes, I see. I will improve this, but the above code will not work as gtkdialog3 will not run pSchedule and I would switch the order to run gtkdialog if available. I assume that gtkdialog will be the latest.


Sigmund

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#107 Post by zigbert »

Version 1.1.0
See main post


Changelog
- NLS is supported by gettext.
- Simplified edit/add gui.
- Improved scaling og gui.
- Code cleanup.
- Skip lines in crontab that starts with #. (thanks to miriam)
- gtkdialog is now only supported executable - no gtkdialog(x).

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#108 Post by zigbert »

Version 1.1.1
See main post

Changelog
- Updated 'About' box.
- Bugfix: Minor syntax changes.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#109 Post by zigbert »

Version 1.1.2
See main post

Changelog
- new switch -n (set new task)


the -n switch is used by pMusic 3.1

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#110 Post by don570 »

When I installed version 1.1.1 in the distro Carolina
I got a strange warning that 'cron gtkdialog' was needed.

It seems to be working allright. I'll continue to test with version 1.1.2.


EDIT: other apps are showing the same warning when
I install in Carolina so it must be a bug in Carloina

Image



_________________________________________________

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#111 Post by canbyte »

Hi. Is there any way to save events entered into pschedule other than during the shutdown save. These days I'm just turning off the pc instead of going through normal shutdown to maintain the pup_save file unchanged. (also turned off periodic save). Of course this means that any pschedule events entered during the session are lost. Is there a way to force saving without a full pup_save save?

Thanks in advance.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#112 Post by don570 »

canbyte wrote:Is there a way to force saving without a full pup_save save?
The crontab's are hidden away some where in the
system in a file . I'm not sure what its name is (but it has 'cron'
or 'crontab' in the name??)

In the terminal you can type.....

Code: Select all

crontab -l  > crontab.txt
or...

Code: Select all

crontab -e
Save the file for your reference.

__________________________________

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#113 Post by canbyte »

Thanks don570.
I pfound the usr/bin/crontab file but it had a gear icon and wouldn't open with geany as text so I kept looking. Another file found, var/spool/cron/crontabs/root, was happy to open with geany as text and showed my list of events. From there, I just used the normal drag/copy procedure to place a copy on my flash drive which can then be recopied back to the var/spool/cron/crontabs directory when needed.

I'm sort of wondering if the root file can be moved or linked to the flash drive I put my files on or if this will cause system confusion during startup - ie the period after startup but before the flash drive is mounted. Hmm. I'll probably just go with the simple solution but would appreciate any thoughts on the idea.

Thanks again
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#114 Post by don570 »

Writing a startup script is possible in Puppy. ie a script
that is launched every time you startup your computer.

It could automate the saving of the file 'root' every day (or hour)

Search in google under 'startup script + murga'
and see what is available

____________________________________

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#115 Post by miriam »

I have quite a few small scripts that I've put in my /root/Startup/ folder. Just write a simple script to do whatever it is you want, then when you're happy with it copy it to the Startup folder. It will be run each time you run Puppy.

Remember to set the executable attribute/permission flag (right-click it and check its "Properties). Also make sure the first line of the script is

Code: Select all

#!/bin/sh
because that lets it be run as a command.

Off the top of my head I imagine you could do something like this:

Code: Select all

#!/bin/sh
# restore previously saved crontab backup (if it exists)
if [ -e /root/crontab.bak ]; then
   cp  /root/crontab.bak  /var/spool/cron/crontabs/root
fi
# endlessly loop, backup crontab each hour
while [ true ]
do
   sleep 1h
   cp  /var/spool/cron/crontabs/root  /root/crontab.bak
done
It will restore the backup made last time this script ran (if it exists) and then start an endless loop that will make a backup of the current crontab every hour. Of course if you change your crontab and switch off your computer (without the standard shutdown sequence) before it has a chance to save the next backup then you'll still lose it. You could make the backup more frequent, but that shortens the life of flash memory if your storage is on flash drive. Or you could make the loop run faster with a delay of just 5 minutes, but check if the crontab has changed so that it only needs to be backued up if an alteration has been made. There are several ways you could check if the file has changed. Perhaps you could use the diff command.

Or maybe test the file with if [ -N /var/spool/cron/crontabs/root ] test to see if the file has been modified since it was last accessed (not sure if that would work because I don't know how often cron accesses the file).

Using diff would seem to be the easiest. Here is an example of how to test:

Code: Select all

if [ "`diff /var/spool/cron/crontabs/root  /root/crontab.bak`" != "" ]; then
   cp  /var/spool/cron/crontabs/root  /root/crontab.bak
fi
because diff doesn't print anything, so it is an empty string, if the two files are the same. But we want to do the copy if they are different -- that is, if the output of diff is not identical to "", so we use != which means not identical to. The backticks (`...`) around the diff command lets us run the command and insert the result into the test. It then has to be inside quotes so that it can be tested as a string.

So your end result might look something like this:

Code: Select all

#!/bin/sh
# restore previously saved crontab backup (if it exists)
if [ -e /root/crontab.bak ]; then
   cp  /root/crontab.bak  /var/spool/cron/crontabs/root
fi
# endlessly loop, backup crontab each ten minutes if it has changed
while [ true ]
do
   sleep 10m
   if [ "`diff /var/spool/cron/crontabs/root  /root/crontab.bak`" != "" ]; then
      cp  /var/spool/cron/crontabs/root  /root/crontab.bak
   fi
done
Hope this helps.
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#116 Post by don570 »

I think pschedule itself can be used to copy the file 'root'

to another partition like a USB stick on a scheduled basis.

I was able to do it but I'll need to check more.

_________________________________________________

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#117 Post by canbyte »

You folks are totally incredible. I asked for 'thoughts' and you responded with invention and research galore. Wow, what puppies! It will take me awhile to digest and try all these ideas as there's a lot on my plate at the moment but I wanted to say thanks, I'm still here.

BTW, it occurs to me that this conversation is equally applicable to the browser's bookmarks and history files, which also disappear if I turn off without saving. Hmm. Maybe like that script miriam suggested??? Attached to a save icon on the desktop so one just clicks it before shutting down??? And a similar one for just after bootup??? (I'm trying to think if there are times when one might not want an automated script in the startup directory as suggested)

Thanks again.
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#118 Post by miriam »

:) The sharing that people like to do if given a chance is one of the things that gives me great hope for humanity.

Some Puppy versions already use a save button to flush buffers and save settings in a flash-booted system. However, I think that if you do a controlled shutdown instead of simply switching off then that is effectively what the computer does -- it saves settings and unmounts flash drives after flushing buffers to them.

I find it annoying having to ask my computer to shut down, instead of just shutting it off, but these days it has its uses, especially when using blasted flash drives.

Flash drives are very convenient (compact, low power, high capacity, retain data without power), but are annoyingly fragile, requiring stuff to be written in large chunks instead of a byte at a time, which then means stuff is held back til enough is accumulated in a buffer to be written. As a result, pulling a flash drive out before a buffer is emptied to it leaves it, at worst corrupted, at best incomplete. I don't know why this is still a problem. Way back in the '80s when I used Amiga computers we had solved this. If a floppy disk was ejected in the middle of a write the Amiga put up a warning that the file hadn't been completely written and requested that you put the disk back in any drive, whereupon it resumed. We could have the same solution today, but all operating systems seem to have forgotten such old answers. [sigh]

Of course this is a problem for USB connections generally, not just flash drives. I'm currently repairing a large (1 terabyte) drive for a friend after it got corrupted when it was unplugged before a write completed. It was being used on MSWindows and formatted as NTFS (though Linux is not much safer). There is really no excuse for this kind of fragility. Maybe the next version of Linux's filesystem will be a partial solution.

Please excuse the rant. :)
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
canbyte
Posts: 264
Joined: Sat 10 Jan 2009, 20:20
Location: Hamilton, Canada

#119 Post by canbyte »

Hi Miriam. I enjoyed your rant - should be brought to the attention of puppy or linux designers. The reason I avoid the regular shutdown save is to avoid the gradual deterioration in performance that seems to go along with that. So Instead of saving everything into the _save file, perhaps a menu could be provided with options of what to save outside the _save file. I'll be trying to get my noobrain around your script idea to set something up as soon as the dust settles around here.

Another thing I've wondered is if this nice little scheduler can be set up for common committee schedules such as every other Wednesday, third Thursday of the month, reminder every other hour (instead of hourly), etc.?

Thanks
[color=orange]1. Dell Dimension E521, AMD Athln 64, 2 GHz 1.93GB ram,
Puppy 533 on CD, accesses flash drive only,
FFox Nightly12.0
2. Compaq P3 733Hz 375RAM
Printer: Oki C3400 > LAN [/color]

User avatar
miriam
Posts: 373
Joined: Wed 06 Dec 2006, 23:46
Location: Queensland, Australia
Contact:

#120 Post by miriam »

You could write a script containing a simple or not-so-simple list of what you want to do and invoke it on desired days using pschedule.

I think wed/2 in the day-of-week field will activate every second Wednesday. Best to read the documentation of cron (which is what pschedule is the front-end for). I'm not sure how you'd get cron (pschedule) to recognise the 3rd week of the month. I think there is a solution for the every-2nd-hour problem in the cron documentation.

Try

Code: Select all

man cron
or

Code: Select all

man crontab
on a commandline (crontab is the text file that holds all the scheduling info -- this is what pschedule displays), or use the Puppy help icon to lookup information. If that fails to give you the info look up the man page or articles online that discuss cron. The Linux Documentation Project http://tldp.org/docs.html has lots of great info, including all the manual pages for hundreds of Linux commands in an easily downloadable compressed file. The first couple of hundred issues of The Linux Gazette are online for free download at http://linuxgazette.net/ftpfiles/ and often contains useful articles and command tips. Issue 6 includes a short article about cron http://linuxgazette.net/ftpfiles/lg-issue01to08.tar.gz (you'll also need http://linuxgazette.net/ftpfiles/lg-base.tar.gz and possibly http://linuxgazette.net/ftpfiles/lg-base.tar.gz)

I keep an enormous reference directory (about 1.5GB) on my computers containing all the manuals (in html format) along with examples, useful articles I've found on the web, all the HOWTO documents and my own notes. This is so I can quickly look up almost anything I want at a moment's notice whether I'm near a net-connection or not. It seems like a lot, but it easily fits on the smallest flash drive these days -- a massive reference library in the palm of my hand. :)
[color=blue]A life! Cool! Where can I download one of those from?[/color]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#121 Post by don570 »

The copy command 'cp' has an option -u that might be useful in
pschedule.


With this option the copy is only made if the source file is newer.
-u, --update
copy only when the SOURCE file is newer than the destination file
or when the destination file is missing
_____________________________________________

trowsdale
Posts: 4
Joined: Tue 20 Nov 2012, 17:16

#122 Post by trowsdale »

dumb question - but I'll ask anyway.

I love Pschedule, it's doing exactly what I need it to.

As is the norm for cron, if the computer isn't powered up, and a Pschedule job is scheduled to run, the job simply won't run.

Is there any way to get Pschedule to run these deferred jobs when the computer is powered up?

I've heard that anacron can do this - can this program somehow be "tied in" to Pschdule?

Thanks for any tips (for a relative newbie)

Bill

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#123 Post by don570 »

There is a log describing when the user shutdown and reboots

/var/log/

and from that info and the crontab info it would be possible to
write a list of jobs that were missed while the computer was shutdown,
but nobody has written a script to do that ???

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#124 Post by don570 »

A francophone user complained about Lucid 528 not working with
pschedule.

http://murga-linux.com/puppy/viewtopic.php?t=85533

I suggested updating to latest gtkdialog version

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#125 Post by zigbert »

don570
I have now uploaded the NLS_old package.


Thank you
Sigmund

Post Reply