We want to execute the following line each time at 00:00 night
Dose this line is valid in crontab or cron job inspite commands with several lines ?
0 0 * * * find . -type f \( -name '*.wsp' -printf WSP -o -printf OTHER \) -printf ' %T@ %b :%p\0' | sort -zk 1,1 -k2,2rn | gawk -v RS='\0' -v ORS='\0' '
{du += 512 * $3}
du > 10 * (2^30) && $1 == "WSP" {
sub("[^:]*:", ""); print
}' | xargs -r0 rm -f
cron
will treat any unescaped%
characters as end-of-line markers - see for example What is causing my “Unexpected EOF Error while looking for …” error? – steeldriver Aug 09 '18 at 16:43cron
call that. Is this not a viable solution here for some reason? – DopeGhoti Aug 09 '18 at 16:43crontab
file I'd pull it out into a script. I'd use the opportunity to throw in some comments too. Future maintenance... – Chris Davies Aug 09 '18 at 16:59