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 Mon 21 Apr 2014, 10:34
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Is it possible to run a cron-job in 1.0.4?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
Staffan

Joined: 14 Sep 2005
Posts: 12
Location: Sweden

PostPosted: Fri 30 Sep 2005, 11:44    Post subject:  Is it possible to run a cron-job in 1.0.4?  

Hello,

is it possible to run a cron-job in PuppyLinux 1.0.4 or do I have to install something for this to be possible?

Regards,

Staffan
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 30 Sep 2005, 12:21    Post subject:  

You could try a small shellscript.

I saved it in /root/notcron

notcron.sh

Code:
#!/bin/sh

mytime=`date +%k%M`
checktime=`head -n 1 /root/notcron/mytask.txt | sed "s/#.*$//"`
todo=`head -n 1 /root/notcron/mytask.txt | sed "s/^[^#]*#//"`

echo current time is: $mytime
echo next task $todo at:  $checktime

if [ "$mytime" = "$checktime" ]; then
  $todo &
fi
sleep 60
$0


You also need a file that has the instruction what to do:
mytask.txt

Code:
1749#leafpad


-----
First make it executable:
chmod 755 /root/notcron/notcron.sh

Start it before starting X in one of the startup-scripts:
/root/notcron/notcron.sh &

The & runs it in background.

Limitations:
it just runs 1 command, for more it had to be enhanced.
Or you make copies (notcron02.sh, mytask02.txt)

Greets, Mark
Back to top
View user's profile Send private message Visit poster's website 
Staffan

Joined: 14 Sep 2005
Posts: 12
Location: Sweden

PostPosted: Tue 04 Oct 2005, 02:39    Post subject:  

Many thanks!

This is probably precisely what I need. Do you by any chance know if there is a way to see how long it was since the keyboard (or mouse) was used? I would need it to see if I should suspend the computer or not.

Regards,
Staffan
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sun 09 Oct 2005, 21:11    Post subject:  

Yes.

At least for the mouse:
http://www.murga.org/%7Epuppy/viewtopic.php?t=2814

To be enhanced...

Greets, Mark
Back to top
View user's profile Send private message Visit poster's website 
Staffan

Joined: 14 Sep 2005
Posts: 12
Location: Sweden

PostPosted: Thu 13 Oct 2005, 09:38    Post subject:  

thanks for the link, but where is the code? Is it in the .pup-file? If so, how do I read it? You got it right with that I want to use a screensaver-like application to shut down the computer once it has been left idle for a while.

Regards,
Staffan
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 13 Oct 2005, 14:39    Post subject:  

Install the pup.

Then replace /usr/local/PuppyBasicScreensaver02/resource/sc.sh with your own shellscript.

If you do it, you should not run the "choose module" in the grafical setup, as it overwrites sc.sh with the shellscripts that are part of my screensaver.


This solution uses a patched version of rsaver, a small screensaver written in C.
I included the source in the Dotpup for C-coders (but it is not needed to look at it).
My patch is only to run sc.sh instead of starting the inbuilt grafics of the original rsaver.

If things remain unclear, please ask again.

Mark
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
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.0427s ][ Queries: 11 (0.0048s) ][ GZIP on ]