Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

delete file bash script with time and date

#!/bin/bash

path="/data/backuplog/"
timestamp=$(date +%Y%m%d_%H%M%S)    
filename=log_$timestamp.txt    
log=$path$filename
days=7

START_TIME=$(date +%s)

find $path -maxdepth 1 -name "*.txt"  -type f -mtime +$days  -print -delete >> $log

echo "Backup:: Script Start -- $(date +%Y%m%d_%H%M)" >> $log


... code for backup ...or any other operation .... >> $log


END_TIME=$(date +%s)

ELAPSED_TIME=$(( $END_TIME - $START_TIME ))


echo "Backup :: Script End -- $(date +%Y%m%d_%H%M)" >> $log
echo "Elapsed Time ::  $(date -d 00:00:$ELAPSED_TIME +%Hh:%Mm:%Ss) "  >> $log
Comment

PREVIOUS NEXT
Code Example
Shell :: install kismet for raspberry pi 
Shell :: az aks get kubeconfig 
Shell :: conflict: unable to remove repository reference sail 
Shell :: dnf install specific version 
Shell :: sed replace environment escape 
Shell :: details of a long format in linux and unix based OS 
Shell :: logitech m525 linux driver ubuntu 
Shell :: MongoInvalidArgumentError: Argument "docs" must be an array of documents 
Shell :: ros2 build from source 
Shell :: reset pop os audio 
Shell :: openfoam for ubuntu 
Shell :: https://www.npmjs.com/package/instagram-private-api 
Shell :: Linux search manual and list all pages with term 
Shell :: Roughly list out the background processs being run using nohup on linux server 
Shell :: fix EACCEC 
Shell :: upgrade appwrite 
Shell :: refname master is ambiguous 
Shell :: check if vpc id exists 
Shell :: raccoon scanner error command not found 
Shell :: git init bare initialize empty git repository 
Shell :: vs code match all css media queries search panel 
Shell :: find #SUID 
Shell :: pip install dali 
Shell :: insert csv to hive table 
Shell :: git bash add ssh key 
Shell :: find and rm files 
Shell :: add user to sudoer "zsh" customization 
Shell :: git2 
Shell :: microk8s port forward 
Shell :: show addition and deletion git cli 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =