Trying to rotate logs however tee command fails to return after execution
0
votes
1
answer
432
views
My logs
nohup.out
is owned by root
user while I m trying to rotate the logs using system
which has privileged access using sudo
I have written the below script to rotate logs.
cat rotatelog.sh
cp /var/www/html/nohup.out /var/www/html/nohup.out_$(date "+%Y.%b.%d-%H.%M.%S");
sudo tee /var/www/html/nohup.out;
The issue is when I run rotatelog.sh
it does the job but the control does not return to the command line terminal.
i tried > /var/www/html/nohup.out
but I get Permission denied
error.
How can I get the logs rotated and return to the command-line?
Asked by Ashar
(527 rep)
Oct 22, 2022, 03:39 PM
Last activity: Oct 22, 2022, 05:51 PM
Last activity: Oct 22, 2022, 05:51 PM