Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 09-14-2002, 04:21 AM   #1
jpkelly
Triple-A Player
 
Join Date: Mar 2002
Location: San Francisco
Posts: 57
Jaguar retarded maintenance scripts

I would love to know MT's findings on the new maint scripts.

I changed the crontab commands back to the old ones because I like to get the mail it sends out.
Gives me a bit of reassurance that the servers are running ok and I have even spotted and fixed some problems I spotted in the mail.
I have also added psync and rsync commands to /etc/daily.local to back up my system and mirror web pages to another machine.
jpkelly is offline   Reply With Quote
Old 09-14-2002, 09:16 AM   #2
bluehz
MVP
 
Join Date: Jan 2002
Posts: 1,562
I don't suppose you could detail what you did to get back to the old-style maint scripts could you. I too like getting the mail.
bluehz is offline   Reply With Quote
Old 09-14-2002, 10:24 AM   #3
jpkelly
Triple-A Player
 
Join Date: Mar 2002
Location: San Francisco
Posts: 57
I used Webmin to edit the crontab but you could use CronniX or whatever other method to edit crontab.

I changed

Code:
periodic daily
periodic weekly
periodic monthly
back to

Code:
sh /etc/daily	2>&1 | tee /var/log/daily.out	| mail -s "`hostname` daily output"   root
sh /etc/weekly	2>&1 | tee /var/log/weekly.out	| mail -s "`hostname` weekly output"  root
sh /etc/monthly 2>&1 | tee /var/log/monthly.out | mail -s "`hostname` monthly output" root
jpkelly is offline   Reply With Quote
Old 09-14-2002, 11:23 AM   #4
enola
Guest
 
Posts: n/a
Another way to get the log mailed to you is leave the crontab as is and add a file called periodic.conf.local in your /etc directory.

Then add the following into the file:

daily_output="username"
weekly_output="username"
monthly_output="username"

Where username is your username. What this doesn't get you though is an email and output written to a file. If you want both go with jpkelly's suggestion.
  Reply With Quote
Old 09-14-2002, 01:21 PM   #5
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
enola, thanks.

seems that periodic could have scored a little better in the output flexibility dept.

perhaps some tee pipe fitting could be done somewheres to get the singular log back in /var/log and mail sent, e.g.,

daily_output="tee /var/log/daily.out root" # tee /file mailto:user

...
/usr/sbin/periodic...

case "$output" in
tee*) pipe= some crazy machinations to get tee stuffed before mail
/*) pipe="cat >>$output";;
"") pipe=cat;;
*) pipe="mail -s '$host ${arg##*/} run output' $output";;
esac
...


¡no me gusta!

Last edited by mervTormel; 09-14-2002 at 01:25 PM.
mervTormel is offline   Reply With Quote
Old 09-14-2002, 01:41 PM   #6
enola
Guest
 
Posts: n/a
I was thinking maybe that's what "") pipe=cat;; was intended for. To generate output to be piped to whatever the user wants. So if you set

daily_output =""

You could change your crontab to something like the old style entry:

periodic daily | tee /var/log/daily.out | mail -s "`hostname` daily output" username

I haven't actually tried this but looks like it should work.

Last edited by enola; 09-14-2002 at 01:51 PM.
  Reply With Quote
Old 09-14-2002, 01:46 PM   #7
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
yep. you're right. heh.

::keep it stupid, simple syndrome::

thank you for your support.
mervTormel is offline   Reply With Quote
Old 09-14-2002, 06:35 PM   #8
bluehz
MVP
 
Join Date: Jan 2002
Posts: 1,562
Am I understaning this correct....

/etc/periodic.conf.local

daily_output=""
weekly_output=""
monthly_output=""

---

/etc/crontab

periodic daily | tee /var/log/daily.out | mail -s "`hostname` daily output" root
bluehz is offline   Reply With Quote
Old 09-14-2002, 06:36 PM   #9
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
roger. that looks copacetic.
mervTormel is offline   Reply With Quote
Old 09-15-2002, 09:29 AM   #10
bluehz
MVP
 
Join Date: Jan 2002
Posts: 1,562
This is the e-mail I got this morning - after the first run of daily - setup as described:

"No output from the 2 files processed"

Any ideas?

Quote:
Originally posted by bluehz
Am I understaning this correct....

/etc/periodic.conf.local

daily_output=""
weekly_output=""
monthly_output=""

---

/etc/crontab

periodic daily | tee /var/log/daily.out | mail -s "`hostname` daily output" root

bluehz is offline   Reply With Quote
Old 09-15-2002, 01:38 PM   #11
enola
Guest
 
Posts: n/a
I just tried this in my cron and I got the expected results. A daily.out and an email.

Try running just from the command line:

sudo periodic daily

You should get output like what shows up in the log. I'd start there for troubleshooting.
  Reply With Quote
Old 09-15-2002, 01:41 PM   #12
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
hmm, works here. is there a /var/log/daily.out? if not, i suspect your crontab line, maybe. make sure the command doen't wrap, i.e., the command has to be all on one line.
mervTormel is offline   Reply With Quote
Old 09-15-2002, 04:57 PM   #13
bluehz
MVP
 
Join Date: Jan 2002
Posts: 1,562
Running in the CLI I get the same results:

> sudo periodic daily
> No output from the 2 files processed

/var/log/daily.out is empty

Quote:
Originally posted by enola
Try running just from the command line:

sudo periodic daily

You should get output like what shows up in the log. I'd start there for troubleshooting.

I noticed in the /periodic/* files they both start with:

if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi

Inside the /etc/defaults/periodic.conf file it shows that /etc/periodic.conf.local overides variables in /etc/defaults/. My /etc/periodic.conf/local contains nothing but this:

daily_output=""
weekly_output=""
monthly_output=""

I am not seeing where or how the mechanism works to create and send the output.

Last edited by bluehz; 09-15-2002 at 05:06 PM.
bluehz is offline   Reply With Quote
Old 09-15-2002, 05:21 PM   #14
enola
Guest
 
Posts: n/a
Do you have a /etc/defaults/periodic.conf file? There is a line in there for overriding the values:

Code:
# What files override these defaults ?
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local"
So either two would work for overriding. Okay so let's take the periodic wrapper out of the picture. Just run the script by itself.

sudo /etc/daily

Do you get output? I just ran like this and get the normal output. Have you edited the daily script at all? Something is funky.
  Reply With Quote
Old 09-15-2002, 05:24 PM   #15
bluehz
MVP
 
Join Date: Jan 2002
Posts: 1,562
Trying that as we speak:

Just manually ran daily.local. Terminal shows a good output up to the locate.updatedb stuff. Then and error:

Updating the Locate db:
/usr/libexec/locate.updatedb: line 45: syntax error near unexpected token `setenv'
/usr/libexec/locate.updatedb: line 45: `if (! $?TMPDIR) setenv TMPDIR /var/tmp'

I remember reading there was a syntax error there and a solution - but for the life of me I can not locate that info now!
bluehz is offline   Reply With Quote
Old 09-15-2002, 05:25 PM   #16
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
Quote:
Originally posted by bluehz
Inside the /etc/defaults/periodic.conf file it shows that /etc/periodic.conf.local overides variables in /etc/defaults/. My /etc/periodic.conf/local contains nothing but this:

daily_output=""
weekly_output=""
monthly_output=""

I am not seeing where or how the mechanism works to create and send the output.

My /etc/periodic.conf/local ?

you mean /etc/periodic.conf.local ?

at the end of /etc/defaults/periodic.conf , a function is defined for slurping up the
/etc/periodic.conf.local file.

if you are out of rev on any of the vanilla periodic files, i suggest you get them back to vanilla and try again.

all periodic files should be vanilla, and you should create one file,

/etc/periodic.conf.local

containing daily_output=""

for now.
mervTormel is offline   Reply With Quote
Old 09-15-2002, 05:39 PM   #17
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
45 if (! $?TMPDIR) setenv TMPDIR /var/tmp

no syntax error here. are you talking about the term_program syntax error?

"There is a typo in /usr/share/tcsh/examples/aliases..."

http://www.macosxhints.com/article.p...20826003806202

different thing altogether.

are you running stock csh ? or have you managed to skronk that, too?
mervTormel is offline   Reply With Quote
Old 09-15-2002, 05:42 PM   #18
enola
Guest
 
Posts: n/a
Quote:
Originally posted by bluehz
Just manually ran daily.local.

Okay, I take it by this that you've got a /etc/daily and a /etc/daily.local. Go with mT's advice and go back to a vanilla setup. Rename daily.local to something else so that it doesn't get called by /etc/daily and that things finish correctly.
  Reply With Quote
Old 09-16-2002, 09:54 AM   #19
jpkelly
Triple-A Player
 
Join Date: Mar 2002
Location: San Francisco
Posts: 57
got this in the mail today:
From daily output
Subject: crabtree daily run output

Removing scratch and junk files:
rm: ./Mount01: is a directory
rm: ./Mount02: is a directory
rm: ./Mount03: is a directory
rm: ./Mount04: is a directory
rm: ./zBooterMnt: is a directory

What does it mean?
jpkelly is offline   Reply With Quote
Old 09-16-2002, 10:25 AM   #20
bluehz
MVP
 
Join Date: Jan 2002
Posts: 1,562
Virgin install and everything seems to be working now. Got the e-mail and all. Thanks guys for the help.

FYI - I also see the:

Removing scratch and junk files:
rm: ./Mount01: is a directory
rm: ./Mount02: is a directory
rm: ./Mount03: is a directory
rm: ./Mount04: is a directory
rm: ./zBooterMnt: is a directory
bluehz is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.