Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Script to zip users cmd history log files

by hedkandi (Initiate)
on Feb 03, 2012 at 03:37 UTC ( #951591=note: print w/ replies, xml ) Need Help??


in reply to Re: Script to zip users cmd history log files
in thread Script to zip users cmd history log files

Hi there, never mind. I wanted to do a Perl Script of the commands I provided but had some help doing it in Bash script so that pretty much did the job.

#!/bin/bash OLD_HIST_DIR="/var/log/user_history/old_logs" HIST_DIR="/var/log/user_history" MNTH_DEST_DIR="/var/log/user_history/old_logs/$(date +'%m')" # date +'%m' gives number corresponding to the current month in 01,02, +...11,12 fashion mkdir -p "${MNTH_DEST_DIR}" "${OLD_HIST_DIR}" # This will create the +directory if not present cp -p ${HIST_DIR}/*history ${OLD_HIST_DIR} gzip -9 ${OLD_HIST_DIR}/*history mv ${OLD_HIST_DIR}/*.gz ${MNTH_DEST_DIR}
@admins you may close this thread


Comment on Re^2: Script to zip users cmd history log files
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-10-01 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (29 votes), past polls