Linux 开机监控
来源:互联网 发布:淘宝买东西卖家发两份 编辑:程序博客网 时间:2024/04/27 23:30
问题: (开机运行的时候找不到camshot程序,所以我给camshot加上了完全路径。)
最主要参考了奶牛的博客, 谢谢啦:
http://www.nenew.net/linux-security-arch-linux-auto-mail-notification.html
http://www.nenew.net/linux-camera-shot-camshot.html
结合我转载的Mutt发送邮件,camshot 在命令行下拍照以及让脚本开机运行。
可以做出一个很简单的开机监控应用。
capture.sh 内容如下:
#!/bin/sh#chkconfig:23456 99 05#send email to $dst \ #with $subject $attach#variable settingdst=chj90220@126.comsubject=`date` subject="$subject: someone startup you computer"content="someone startup you computer.His/Her image is in attachment.please check"attach=date_$$.bmpbmppipe="pipefile"logout=/run/media/huntinux/F/linux-space/log/capturelog.outlogerr=/run/media/huntinux/F/linux-space/log/capturelog.err# get picture through camera/run/media/huntinux/F/huntinux_bin/camshot-1.0/camshot-read-only/camshot -W 320 -H 240 -p ./$bmppipe 1>$logout 2>$logerr &sleep 5cat $bmppipe >$attach# send picture to email $dstecho "$content" | mutt "$dst" -s "$subject" -a "$attach"# close camshot kill `ps aux |grep camshot|grep -v grep|awk -F " " '{printf $2}'`#rm -rf $attachexit 0
测试成功后,将其开机自动启动即可。
# chmod +x captuer.sh
# cp capture.sh /etc/init.d/
# chkconfig --add capture.sh
# chkconfig --list capture.sh
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
capture.sh 0:off 1:off 2:on 3:on 4:on 5:on 6:on
重启即可在邮箱看到邮件。看看里面有没有照片。哈哈
- Linux 开机监控
- Linux开机
- 监控Linux
- linux监控
- Linux开机程序内幕
- Linux开机程序内幕
- linux开机流程分析
- Linux 开机流程分析
- Linux开机启动Oracle
- LINUX开机和关机
- 检测linux开机时间
- LINUX开机和关机
- linux 开机自动运行
- linux开机启动
- Linux 开机启动文件
- linux开机启动
- Linux开机流程
- Linux开机启动Oracle
- 关于硬链接和软连接(符号链接)的区别
- 社团的那些事(6)
- 【人在运维囧途_13】由LDAP服务器无法登陆来谈谈分析问题的思路
- 活动轮廓研究人员和重要文献
- 全国软件-----------猜生日
- Linux 开机监控
- Android使用代码
- Android碰撞检测——多矩形检查
- 常见的机器视觉软件
- Oracle的锁表与解锁
- [USACO3.2.4 Feed Ratios]
- 防止Entity Framework重复插入关联对象
- 函数指针实现的两种方法
- 博客园左侧导航jQuery+Css