09-28-2011
Need help setting up script
Hello all, I am trying to setup a script that will copy any files older than 30 days in four directories to my windows box, then delete any files older than 30days in the four directories, verify that they are deleted, then send me a confirmation email.
I would like to set this up as a cron job to run once a week on Sunday at 9pm.
So far I have this for the script:
find /data/folder1/ -type f -mtime +30 | xargs rm -f
find /data/folder2/ -type f -mtime +30 | xargs rm -f
find /data/folder3/ -type f -mtime +30 | xargs rm -f
find /data/folder4/ -type f -mtime +30 | xargs rm -f
That is the portion for deleting the files, but I am not sure about copying the files first to my windows box, verifying they are deleted, then sending an email.
The box is solaris 8. I don't have much experience with Unix so I appreciate the help.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
HP-UX 11
I currently have a script that is running useradd and passwd commands to automate setting up new users. It was originally designed so that passwd was run with -d -f to delete a passwd and force user to set passwd at next login. Now mgmt wants instead to set a first-time passwd and have... (2 Replies)
Discussion started by: LisaS
2 Replies
2. AIX
hi, am new to AIX.
i have an issue. iam asked to change the umask setting on a logon script on a server to prevent writable files. i logged in as the root user and typed in umask and it displays 022, which i believe is 755 for direc and 644 for files.
1) how to I identify where the logon script... (2 Replies)
Discussion started by: karthikosu
2 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
I know to set global variable i can use export .. But take the situation like below ..
I want to set a variable in one script and access that in second script
i have done like this .. It is not working
one.sh
#!/usr/bin/ksh
echo $RISSHI
export RISSHI=1
two.sh... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
4. Shell Programming and Scripting
Hi
i need to have a update for a file that updates only the last modified content from another file....
say for example....if file A is having content like
.
.
.
hatxxxx
catxxxx
ratxxxx
and file B(the file to be updated is having content as
hatxxxx
catxxxx
then file B has to be... (12 Replies)
Discussion started by: spikywits
12 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I wrote two small scripts to set env variables in a shell.
java_env.csh
#!/bin/csh -fn
setenv JAVA_HOME '/scratch/software/jdk1.5.0_11'
setenv PATH $PATH':'$JAVA_HOME'/bin'
and run it using csh ./java_env.csh
But the env variables are not set. I tried running each line on the... (5 Replies)
Discussion started by: NoviceAmod
5 Replies
6. Shell Programming and Scripting
#!/bin/ksh
row=`sed '1!G;h;$!d' file1.xml | head -2| tail -1`
echo "$row" | awk -F"" '{$esum=$5}'
row=`sed '1!G;h;$!d' file2.xml | head -2| tail -1`
echo "$row" | awk -F"" '{$isum=$5+$19}'
echo "Exp:$esnum"
echo "Imp:$isum"
if
then
echo "Matched"
else
echo "Not matched"
fi
... (6 Replies)
Discussion started by: skyineyes
6 Replies
7. Shell Programming and Scripting
Hello all,
I know this must be simple .... but i can't grasp what could be the issue.
I'm trying to setup the timezone variable (to the unix command date) according to what i find in a value that i got from parsing the config file.
The end result would be setting the log file with this new... (4 Replies)
Discussion started by: maverick72
4 Replies
8. Shell Programming and Scripting
I have a script and I want the verbosity option to work in the following way:
User can either set quiet (no verbosity), use default verbosity level (when doing -v), or set a level value (when doing -v=2 or --vrbLevel=2).
I am making some more progress on this and am thinking of this idea.
... (4 Replies)
Discussion started by: kristinu
4 Replies
9. Shell Programming and Scripting
Dear all,
I wonder if it is possible that we can run the script
from time to time..I meant, it should repeat the
sourcing of the script by itself? In my case, I need
to source this script manually from time to time,
like once in every 10 minutes.
emily, (2 Replies)
Discussion started by: emily
2 Replies
10. Solaris
Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users.
In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies
LEARN ABOUT CENTOS
fixfiles
fixfiles(8) fixfiles(8)
NAME
fixfiles - fix file SELinux security contexts.
SYNOPSIS
fixfiles [-v] [-F] [-B] [ -N time ] [-l logfile ] { check | restore|[-f] relabel | verify } [[dir/file] ... ]
fixfiles [-v] [-F] [ -R rpmpackagename[,rpmpackagename...] ] [-l logfile ] { check | restore | verify }
fixfiles [-v] [-F] -C PREVIOUS_FILECONTEXT [-l logfile ] { check | restore | verify }
fixfiles [-F] [-B] onboot
DESCRIPTION
This manual page describes the fixfiles script.
This script is primarily used to correct the security context database (extended attributes) on filesystems.
It can also be run at any time to relabel when adding support for new policy, or just check whether the file contexts are all as you
expect. By default it will relabel all mounted ext2, ext3, xfs and jfs file systems as long as they do not have a security context mount
option. You can use the -R flag to use rpmpackages as an alternative. The file /etc/selinux/fixfiles_exclude_dirs can contain a list of
directories excluded from relabeling.
fixfiles onboot will setup the machine to relabel on the next reboot.
OPTIONS
-B If specified with onboot, this fixfiles will record the current date in the /.autorelabel file, so that it can be used later to
speed up labeling. If used with restore, the restore will only affect files that were modified today.
-l logfile
Save the output to the specified logfile
-F Force reset of context to match file_context for customizable files
-f Clear /tmp directory with out prompt for removal.
-R rpmpackagename[,rpmpackagename...]
Use the rpm database to discover all files within the specified packages and restore the file contexts. (-a will get all files in
the RPM database).
-C PREVIOUS_FILECONTEXT
Run a diff on the PREVIOUS_FILECONTEXT file to the currently installed one, and restore the context of all affected files.
-N time
Only act on files created after the specified date. Date must be specified in "YYYY-MM-DD HH:MM" format. Date field will be passed
to find --newermt command.
-v Modify verbosity from progress to verbose. (Run restorecon with -v instead of -p)
ARGUMENTS
One of:
check print any incorrect file context labels, showing old and new context, but do not change them.
restore
change any incorrect file context labels.
relabel
Prompt for removal of contents of /tmp directory and then change any incorrect file context labels to match the install file_con-
texts file.
verify List out files with incorrect file context labels, but do not change them.
[[dir/file] ... ]
List of files or directories trees that you wish to check file context on.
AUTHOR
This man page was written by Richard Hally <rhally@mindspring.com>. The script was written by Dan Walsh <dwalsh@redhat.com>
SEE ALSO
setfiles(8),restorecon(8)
2002031409 fixfiles(8)