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 Wed 26 Nov 2014, 13: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 Posts_count  
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: 13644
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_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: 13644
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_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: 13644
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_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0479s ][ Queries: 11 (0.0033s) ][ GZIP on ]