From e2641d740b814ad089b2ac799ef7e0d9e8a1b365 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Bhuyan <39624221+pradeepbhuyan@users.noreply.github.com> Date: Thu, 2 May 2019 16:36:41 +0530 Subject: [PATCH 1/6] Create delete_oldlogfile.sh creating script for delete old log files and subdirectory more than 7 days older. --- delete_oldlogfile.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 delete_oldlogfile.sh diff --git a/delete_oldlogfile.sh b/delete_oldlogfile.sh new file mode 100644 index 0000000..d1d6017 --- /dev/null +++ b/delete_oldlogfile.sh @@ -0,0 +1,37 @@ +#/bin/bash +###################################### +#Script Name: Log_file_deletion.sh +#Summary: Delete the log file and sub-directoy older that 7 days +#Author: Pradeep Bhuyan +#Date: 01-May-2019 +###################################### + +if [ $# -ne 1 ]; then + echo "Need one argument, which would be the log file path." + exit 1 +fi + +LOG_DIRS=$1 +LOG_FILE="/home/ec2-user/log.txt" + +exec 1>$LOG_FILE +exec 2>>$LOG_FILE + +TIMESTAMP=`date +%Y:%m:%d` + +DAYS_OLD="7" # This will find and delete folders and files older than 7 days. + +echo "....................................." +echo "Starting Deletion job on : $TIMESTAMP" + +echo "Looking for Files in $DIR" +find $DIR -type f -mtime $DAYS_OLD +find $DIR -type f -mtime $DAYS_OLD -exec rm -f {} \; +echo "Deleted found files" + +echo "Now Looking for Empty Folders Older than $DAYS_OLD Days" +find $DIR -type d -empty -mtime +$DAYS_OLD +find $DIR -type d -empty -mtime +$DAYS_OLD -exec rm -rf {} \; + +echo "Cleanup on $TIMESTAMP completed" +exit 0 From cb2f8cc35a45398d3b747daa82d2cf36226347fe Mon Sep 17 00:00:00 2001 From: root Date: Fri, 10 May 2019 08:30:34 +0000 Subject: [PATCH 2/6] pkb1.txt --- pkb1.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pkb1.txt diff --git a/pkb1.txt b/pkb1.txt new file mode 100644 index 0000000..6fe5056 --- /dev/null +++ b/pkb1.txt @@ -0,0 +1,3 @@ +abc +anf +sd From 3bf14e4a75b7ccbadd48a2f26d65f52006223c40 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Bhuyan <39624221+pradeepbhuyan@users.noreply.github.com> Date: Thu, 4 Jul 2019 07:32:01 +0530 Subject: [PATCH 3/6] updated the script updated --- uadd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/uadd.sh b/uadd.sh index 722e934..c48d151 100644 --- a/uadd.sh +++ b/uadd.sh @@ -10,5 +10,6 @@ echo "ecnter the user name $NM" read NM echo "`useradd -d /users/$NM $NM`" +echo "changes done" # END # From a73f5c1d21e231dd4c277179210a0164ac932841 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Bhuyan <39624221+pradeepbhuyan@users.noreply.github.com> Date: Thu, 4 Jul 2019 07:35:29 +0530 Subject: [PATCH 4/6] Update uadd.sh updated --- uadd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/uadd.sh b/uadd.sh index c48d151..81e64ef 100644 --- a/uadd.sh +++ b/uadd.sh @@ -5,6 +5,7 @@ #Modified Date: #WebSite: https://arkit.co.in #Author: Ankam Ravi Kumar +#Author: Ankam Ravi Kumar # START # echo "ecnter the user name $NM" From d62e3ea4695c6a7ecd5f1be34e7f1244485826d7 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Bhuyan <39624221+pradeepbhuyan@users.noreply.github.com> Date: Mon, 19 Aug 2019 11:01:01 +0530 Subject: [PATCH 5/6] updateed add.sh --- add.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/add.sh b/add.sh index b6dec80..5f5569d 100644 --- a/add.sh +++ b/add.sh @@ -5,7 +5,7 @@ #Modified Date: #WebSite: https://arkit.co.in #Author: Ankam Ravi Kumar -# START # +# START of the Script # echo "addition of X+Y" echo "Enter X" @@ -14,4 +14,4 @@ echo "Enter Y" read Y echo "X+Y = $X+$Y = $[ X+Y ]" -# END # \ No newline at end of file +# END # From 3389ba6c8d8d7f393b118833c7e049947f12793a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 17 Oct 2019 13:35:19 +0000 Subject: [PATCH 6/6] update --- delete_build.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 delete_build.sh diff --git a/delete_build.sh b/delete_build.sh new file mode 100755 index 0000000..73fd512 --- /dev/null +++ b/delete_build.sh @@ -0,0 +1,27 @@ +#/bin/bash +###################################### +#Script Name: build_deletion.sh +#Summary: Delete the log file and sub-directoy older that 7 days +#Author: pbhuy002 +#Date: 10-oct-2019 +###################################### + +LOG_FILE="/tmp/build.txt" + +exec 1>$LOG_FILE #################output to logfile +#exec 2>>$LOG_FILE + +TIMESTAMP=`date +%Y:%m:%d` ############current time + +echo "....................................." +echo "Starting Deletion job on : $TIMESTAMP" + +echo "Deleted found dir" + +echo "Now Looking for Folders Older than 60 Days" + +find /root/*/build/ -type d -mtime +60 -exec rm -rf {} \; + +echo "Cleanup on $TIMESTAMP completed" +exit 0 +