📄 example1
字号:
#!/bin/bash ## This is a script from the smartmontools examplescripts/ directory.# It can be used as an argument to the -M exec Directive in# /etc/smartd.conf, in a line like # -m root@localhost -M exec /path/to/this/file## Please see man 8 smartd or man 5 smartd.conf for further# information.## $Id: Example1,v 1.7 2004/08/29 02:33:17 ballen4705 Exp $# Save standard input into a temp filecat > /root/tempfile# Echo command line arguments into temp fileecho "Command line argument 1:" >> /root/tempfileecho $1 >> /root/tempfileecho "Command line argument 2:" >> /root/tempfileecho $2 >> /root/tempfileecho "Command line argument 3:" >> /root/tempfileecho $3 >> /root/tempfile# Echo environment variables into a temp fileecho "Variables are": >> /root/tempfileecho "$SMARTD_DEVICE" >> /root/tempfileecho "$SMARTD_DEVICESTRING" >> /root/tempfileecho "$SMARTD_DEVICETYPE" >> /root/tempfileecho "$SMARTD_MESSAGE" >> /root/tempfileecho "$SMARTD_FULLMESSAGE" >> /root/tempfileecho "$SMARTD_ADDRESS" >> /root/tempfileecho "$SMARTD_SUBJECT" >> /root/tempfileecho "$SMARTD_TFIRST" >> /root/tempfileecho "$SMARTD_TFIRSTEPOCH" >> /root/tempfile# Run smartctl -a and save output in temp file/usr/sbin/smartctl -a -d $SMARTD_DEVICETYPE $SMARTD_DEVICE >> /root/tempfile# Email the contents of the temp file. Solaris and other OSes# may need to use /bin/mailx not /bin/mail./bin/mail -s "SMART errors detected on host: `hostname`" $SMARTD_ADDRESS < /root/tempfile# And exitexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -