Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kron job to remove Tmp files ?? 1

Status
Not open for further replies.

pctekk

MIS
Sep 28, 2002
345
0
0
US
What is the easiest way to create/run a Kron
job to remove tmp files automatically at a specified time of nite ?

we have to do it manually each week.
thanks gang
 
Hi,

This query belongs to an Unix forum.

You may use cron, unix task scheduler to execute predetermine jobs at timely intervals.

crontab -l
will list your current active cron table entries.

crontab -e
will get you directly into edit mode

A crontab input has six fields:
minute (0-59)
hour (0-23)
day of month (1-31)
month of year (1-12)
day of week (0-6, 0 is Sunday)
Command

Example:
0 18 1 * 0 date | mail user
will execute at 6 p.m. on the first of each month as well as at 6 p.m. on every Sunday.

Typically your cammand file will be a script, containing the set of instructions. Command file should specified with full path in crontab specification.

Regards,
Shriyan
 
can you give me an example of say deleting
livetemp* files from a folder path of

/u1/live/spool


??

thanks
 
Hi,

This is a cron entry to run this script every Monday morning at 8:00:
0 8 * * /u1/rmlivetemp.sh

contents of /u1/rmlivetemp.sh
rm -f /u1/live/spool/livetemp*

or

the cron entry could be:
0 8 * * rm -f /u1/live/spool/livetemp*

Regards,
Shriyan
 
Thanks Shriyan

ok...newbee question, how do you/i edit the existing
cron to put this info in to remove those files ?

Thanks
 
pctekk:

As an user you can list your current active cron table entries using:
crontab -l

if you have already one, and to go directly into edit mode, or start a new entry entry for crontab file using:
crontab -e

The default editor is "vi" for editing/adding an entry. For futher help look at mannual pages:
man cron
man crontab

at your operating system prompt. By the way, this site hosts some Unix forums:
forum80
forum822

Regards,
Shriyan
"Each day you are the scholar of yesterday."
 
ok..i did that, can you make sense of this please ??

# crontab -l
# @(#) root 69.1 98/03/10
#
# Copyright (C) 1989-1998 The Santa Cruz Operation, Inc.
# All Rights Reserved.
# The information in this file is provided for the exclusive use of
# the licensees of The Santa Cruz Operation, Inc. Such users have the
# right to use, modify, and incorporate this code into other products
# for purposes authorized by the license agreement provided they include
# this notice and the associated copyright notice with any such product.
# The information in this file is provided "AS IS" without warranty.
#
17 5 * * 0 /etc/cleanup > /dev/null
0 2 * * 0,4 /usr/lib/cron/logchecker
0 1 * * * /usr/bin/calendar -
3 3 * * * /usr/lib/cleantmp > /dev/null
1 3 * * * /etc/setclk -rd1800 > /dev/null 2>&1
#5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
00 23 * * 1-5 /etc/cleanspool
00 02 * * 1,2,3,4,5 /usr/lib/edge/bin/edge.action ws
munis.springs.local:schent/simple_job wsmunis.springs.local:action/s
imple_job
00 03 * * 1,2,3,4,5 /usr/local/bin/uvscan --summary
/ | lp -dpurch
#
 
pctekk,

The list seems to be crontab entries that belong to the superuser (root) of your unix box. It's alright. Do not alter these entries unless you know exactly what you are doing!

You may append a line in this file if you wish, for your activity of cleaning up of /u1/live/spool/livetemp* or you may login as other authorised user and create/add crontab entry of your own apart from a root user.

Regards,
Shriyan
"Minds, like parachutes, work only when they are open."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top