On Monday, March 17, 2003, at 08:09 AM, C. Posey wrote:

Would it be possible to get a copy of your Aquacron script mentioned on the Fink mailing list?

I suggest these steps for using the script listed below. Anacron is required.


For the administrator:

Read the script and satisfy yourself that it does what I claim.
Watch out for line wrap - the longest line is 107 characters.
Copy it to a file named 'aquacron'.
Make the file executable; e.g.,

chmod 744 aquacron

Put it in a root-owned directory; e.g., if you have Fink installed under /sw,

sudo mv aquacron /sw/sbin

Add a line to your system crontab (NOT anacrontab) to call it at, say, one-hour intervals; e.g.,

sudo echo " 0 * * * * root /sw/sbin/aquacron" >> /etc/crontab

For users:

Make a folder called Periodic in your home Library (not the root Library) with any or all of the subfolders Daily, Weekly, Monthly. Anything in these subfolders will be opened exactly once a day, week, or month, respectively, if you start an Aqua session during that period. The effect will be the same as if you had double-clicked the icons in the Finder. If you want to run AppleScripts, they must be saved as applications. Shell scripts must have a name ending in ".command". If you include a folder, it will open in a Finder window, but the contents won't open.

Thanks in advance for comments.

---------------------CUT HERE---------------------
#!/bin/sh

# This software is under no license or warranty. Use at your own risk.
# Call at sub-daily intervals from the root crontab

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/sw/sbin

# Who, if anyone, is logged in to the Aqua console?

the_user=`who -T | grep '\- console' | awk '{ print $1 }'`

# If anacron is not installed or there is no Aqua session running, do nothing

if [ ! -x /sw/sbin/anacron ] && [ -z $the_user ]; then exit; fi

# Generate a default aquacrontab for the user, if needed and none exists

home_dir=`niutil -readprop . /users/$the_user home`
cd $home_dir || exit
the_dir=${home_dir}/Library/Periodic
if [ -d $the_dir ] && [ ! -f .aquacrontab ]; then
        now=`date`
        cat > .aquacrontab << AQUACRONTAB
# Default aquacrontab generated by aquacron: $now
# Before deleting it, first delete or move $the_dir

SHELL=/bin/sh
PATH=/sw/sbin:/sw/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/ sbin:/usr/bin


# period delay job-identifier command
1 15 ${the_user}.daily su ${the_user}; cd ${the_dir}/Daily 2> /dev/null && ls | xargs open
7 20 ${the_user}.weekly su ${the_user}; cd ${the_dir}/Weekly 2> /dev/null && ls | xargs open
30 25 ${the_user}.monthly su ${the_user}; cd ${the_dir}/Monthly 2> /dev/null && ls | xargs open
AQUACRONTAB
chown ${the_user}:80 .aquacrontab; chmod 660 .aquacrontab
fi


# Run the aquacrontab

[ -f .aquacrontab ] && anacron -s -t ${home_dir}/.aquacrontab

---------------------CUT HERE---------------------



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Fink-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-users

Reply via email to