This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Run remove-docker-dangling.service every 30 minutes | |
[Timer] | |
OnCalendar=*:0/30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Removing Docker Dangling Images Cron Service | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/sh -c "/bin/docker rmi $(docker images --quiet --filter 'dangling=true')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Check whether a temporary file exisits | |
if [ ! -e nohup_errors_log ]; | |
#If not you are here | |
then | |
#Grep for the desired pattern within your log file to catch the Error and Save the content to a new temporary file | |
grep "\[[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\},[0-9]\{3\}\] ERROR" /home/ubuntu/ravindu/nohup.out | sort > nohup_errors_log | |
#Mail the recorded error list to the desired mail (You can mail it to multiple uses also) | |
mail -s "Error Log for nohup.out" [email protected] < nohup_errors_log |
NewerOlder