Sponsored Content
Top Forums Shell Programming and Scripting Move log files with date and delete older than 3 weeks Post 302804765 by vidyadhar85 on Thursday 9th of May 2013 06:27:36 AM
Old 05-09-2013
You can use below

Code:
 
mv usr/sbin/appl/tmp/logfile.txt  usr/sbin/appl/tmp/logfile_`date +"%d%b%y"`.txt
find usr/sbin/appl/tmp/logfile*.txt  -mtime +21 -exec rm {} \ ;

This User Gave Thanks to vidyadhar85 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to check whether the given file is 5 weeks older than current date

HI, I need to check whether the given file is 5 weeks older than current date ?? Can anyone give me the script for this ?? (1 Reply)
Discussion started by: risshanth
1 Replies

2. Shell Programming and Scripting

Delete files older than 3 months.(read date from the name of the file)

Guys, My log files stored in the date format format below(log_20080714072942): TIMESTAMP=`date +%Y%m%d%H%M%S` LOG=/log/log_${TIMESTAMP}.log I'm looking for a shell script which deletes all files which is older than 3 months from today. Regards, Bhagat (3 Replies)
Discussion started by: bhagat.singh-j
3 Replies

3. Shell Programming and Scripting

Delete the files older than 3 weeks in a particular directory.

Hi, Friends, I am writing a script to delete all the files which are there for more than 3 weeks. I have tried this : find /home/appl/backup -type f -mtime +21 -exec rm -f {} \; But i am not sure if it deletes only the files in specified directory or all the directorinies in the provieded... (3 Replies)
Discussion started by: rajsharma
3 Replies

4. Emergency UNIX and Linux Support

How to delete all the files which are more than 3 weeks old in a particular directory.Thnx in advanc

(12 Replies)
Discussion started by: rajsharma
12 Replies

5. Shell Programming and Scripting

Move file older date

hlow all i have folder with name like this 20110512 20110601 20110602 so i want move the last 1 day to other directory for example this date 20110602 so i want move folder older 1 day from this date 20110512 -----> this folder will move to other dir 20110601-----> this folder will move... (2 Replies)
Discussion started by: zvtral
2 Replies

6. UNIX for Dummies Questions & Answers

move files older than 2 days to another folder

Hi I am facing problem in using this command, mv `find /export/june/PURGEDATA*.txt -mtime +2 -exec ls {} \;` june/archive/ mv: Insufficient arguments (1) Usage: mv f1 f2 mv f1 ... fn d1 mv d1 d2 Thank you in advance (2 Replies)
Discussion started by: vishwakar
2 Replies

7. UNIX for Advanced & Expert Users

HPUX move files older than 30 days

Hello, I have a script which finds files in a directory that are older than 30 days and moves them to the specified directory. The problem is I don't know why it works the way it does? Code: find . -name '*.sql' ! -mtime -30 -exec mv '{}' /dataload/archivelogs \; I was under the... (4 Replies)
Discussion started by: pure_jax
4 Replies

8. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

9. UNIX for Dummies Questions & Answers

How to delete all the files older than a date?

Hi, I need a command for deleting all the compress files *.Z that are older than the current date - 5 days. Basically I have a directory where daily I meet some back up files and I want to remove automatically the ones 5 days (or more) older than the current date. How can I write a 'rm' command... (1 Reply)
Discussion started by: Francy
1 Replies

10. UNIX for Beginners Questions & Answers

How to move files older than certain time?

If there are 100 files created in a directory /data/ today from 2:00 AM to 10:00 AM I need to move files older than 3:00 AM to a new directory /hold/ How to do that? Also, if I have to move files between 3:00 AM to 9:00 AM, how to achieve that (3 Replies)
Discussion started by: eskay
3 Replies
sconadm(1M)						  System Administration Commands					       sconadm(1M)

NAME
sconadm - register system information SYNOPSIS
/usr/sbin/sconadm register -a [-e softwareUpdate | -E softwareUpdate] [-h hostname] [-l logfile] [-N] [-p proxy_host[:proxy_port]] [-r registration_profile] [-u username] [-x proxy_username] /usr/sbin/sconadm proxy [-l logfile] [-p proxy_host[:proxy_port]] [-r registration_profile] [-x proxy_username] DESCRIPTION
The sconadm utility is a command-line version of the Basic Registration GUI. In the first form of the command in the SYNOPSIS, sconadm uses the register subcommand to register a host with a registration server. In the second form, sconadm uses the proxy subcommand to configure all of the components for software update to use an HTTP web proxy. The parameters specified with -u, -e (or -E), -h, -p, and -x override values specified in your registration profile. A template for this profile, owned by root, with read-only permissions, is stored in /usr/lib/breg/data/RegistrationProfile.properties. See registration_pro- file(4). For the proxy subcommand, the proxy password is stored in the RegistrationProfile.properties file, available if proxy authentication is needed. Storage in the profile prevents proxy passwords from being exposed as part of a listing of processes on a system. OPTIONS
The following options are supported: -a Accept "Terms of Use and Binary Code License". Absence of this option means that you do not accept the license. -e softwareUpdate Enable client to be managed at the Sun-hosted Update Connection Service. -E softwareUpdate Disable client's ability to be managed at the Sun-hosted Update Connection Service. -h hostname Hostname of the machine you want to register. -l logfile Pathname of log file. -N Never register. -p proxy_host[:proxy_port] Proxy host name and optional proxy port number. -r registration_profile Pathname to a registration profile. -u username User name (a Sun Online Account). -x proxy_username User name on the proxy host. EXAMPLES
Unless specified otherwise, the commands below require root privileges or privileges equivalent to root. See privileges(5). Example 1 Registering a New System Assume a file registrationprofile.properties in /tmp that contains the following: userName=user123 password=abc123 hostName= subscriptionKey= portalEnabled=false proxyHostName= proxyPort= proxyUserName= proxyPassword= To register a new system using the profile above, you enter: /usr/sbin/sconadm register -a -r /tmp/registrationprofile.properties Example 2 Reregistering a System with a Different User Assume a file registrationprofile.properties in /tmp with the contents shown below. Note the changed specification for userName and pass- word. userName=newuser password=newpassword hostName= subscriptionKey= portalEnabled=false proxyHostName= proxyPort= proxyUserName= proxyPassword= To reregister a new system using the profile above, you enter the same command you entered to register the system: /usr/sbin/sconadm register -a -r /tmp/registrationprofile.properties Example 3 Reregistering a System, Adding a Sun Subscription Key Modify registrationprofile.properties as follows: userName=newuser password=newpassword hostName= subscriptionKey=abc12345678 portalEnabled=false proxyHostName= proxyPort= proxyUserName= proxyPassword= Run the command: /usr/sbin/sconadm register -a -r /tmp/registrationprofile.properties Example 4 Reregistering and Enabling Access to all Update Connection Services Modify registrationprofile.properties as follows: userName=newuser password=newpassword hostName= subscriptionKey=abc12345678 portalEnabled=false proxyHostName= proxyPort= proxyUserName= proxyPassword= Note that portalEnabled is set to false. Run the command: /usr/sbin/sconadm register -a -r /tmp/registrationprofile.properties -e softwareUpdate Example 5 Never Registering To never register a system, enter: /usr/sbin/sconadm register -N Example 6 Using a Proxy Server With Proxy Authentication Edit registrationprofile.properties as follows: userName= password= hostName= subscriptionKey= portalEnabled= proxyHostName=webcache.mycompany.com proxyPort=8080 proxyUserName=myCompanyProxyUserName proxyPassword=myCompanyProxyPassword Run the command: /usr/sbin/sconadm proxy -r /tmp/registrationprofile.properties Example 7 Changing Proxy Host Settings Edit registrationprofile.properties as follows: userName= password= hostName= subscriptionKey= portalEnabled= proxyHostName=webcache.mycompany.com proxyPort=8080 proxyUserName=myCompanyProxyUserName proxyPassword=myCompanyProxyPassword Run the command: /usr/sbin/sconadm proxy -r /tmp/registrationprofile.properties Then, change the proxyHostName value by running the following command: /usr/sbin/sconadm proxy -r /tmp/registrationprofile.properties -p newproxy.mycompany.com After the preceding command all proxies use newproxy.mycompany.com. Example 8 Resetting a System Not to Use a Proxy Edit registrationprofile.properties as follows: userName= password= hostName= subscriptionKey= portalEnabled= proxyHostName= proxyPort= proxyUserName= proxyPassword= Note that values for all proxy fields are null. Run the command: /usr/sbin/sconadm proxy -r /tmp/registrationprofile.properties EXIT STATUS
0 Success. >0 An error occurred. FILES
/usr/lib/breg/data/RegistrationProfile.properties Registration profile template. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWbrg | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ SEE ALSO
registration_profile(4), attributes(5), privileges(5) SunOS 5.11 27 Feb 2006 sconadm(1M)
All times are GMT -4. The time now is 01:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy