Re: [Dorset] Running Script as Sudo

2025-04-23 Thread Ralph Corderoy
Hi Tim, >     find /var/log/ -name '*.log*' -type f -mtime +7 -print ... > -rwxrwxr-x 1 mit mit 104 Apr 22 21:29 deletefile.sh Does ‘sudo ./deletefile.sh’ — or similar, if it's not in the current directory — now work? > So now for a second question -name '*log*' I assume that this looks for >

Re: [Dorset] Running Script as Sudo

2025-04-22 Thread Tim
Seem simple enough, will have a play but it won't help my scripting skills I found the online Cron autoconfigure useful, you enter when and how frequent you want to run the script and it will give the correct format to enter into crontab. Used to have a nice GUI for Cron which was great, but c

Re: [Dorset] Running Script as Sudo

2025-04-22 Thread Tim
HI Ralph Like the -print option, very useful Will try to remember the single quotes pr -tnv deletefiles.sh give mit@Thinky:~/scripts$ pr -tnv deletefile.sh     1v#!/bin/bash     2v# delete files older than 7 days old     3vfind /var/log/ -name '*.log*' -type f -mtime +7 -print I know the seco

Re: [Dorset] Running Script as Sudo

2025-04-22 Thread Peter Merchant
On 21/04/2025 18:27, Tim wrote: Good evening on this damp squid of Easter I will admit that scripting is not my thing but at times I decide I am going to try and improve my scripting (it is basic). So here what my issue is, I want to delete some .log file from /var/log so I have a very simple

Re: [Dorset] Running Script as Sudo

2025-04-22 Thread Ralph Corderoy
Hi Tim, Bob wrote: > Tim wrote: > > find /var/log/ -name "*.log" -type f -mtime +7 -delete Start with -print instead of -delete so if you have a bug you don't delete the wrong files. Also, use '' instead of "" in general as the shell interprets less within them, i.e. the contents are more litera

Re: [Dorset] Running Script as Sudo

2025-04-22 Thread Bob Dunlop
Hi, On Mon, Apr 21 at 06:27, Tim wrote: > Good evening on this damp squid of Easter > > I will admit that scripting is not my thing but at times I decide I am > going to try and improve my scripting (it is basic). > > So here what my issue is, I want to delete some .log file from /var/log > so