Autostart script in ubuntu
发布时间:2020-11-18 00:35:14 所属栏目:Ubuntu 来源:互联网
导读:1. Problem I want to run some scripts when the machine is powered up. 2. Analysis Ubuntu save autostart scripts in /etc/xdg/autostart/. All the files in this folder will run automatically. So I just n
1. ProblemI want to run some scripts when the machine is powered up. 2. AnalysisUbuntu save autostart scripts in /etc/xdg/autostart/. All the files in this folder will run automatically. So I just need to create my custom file in this folder. You can use gnome-session-properties to call a window applicantion. 3. Solution3.1 Prepare scripts3.1.1 rjsupplicant.shsudo vim /etc/init.d/rjsupplicant.sh #!/bin/bash echo [sudo password] | sudo -S /opt/rjsupplicant/rjsupplicant.sh -d 1 -u [username] -p [rj password] -S 1 & sudo chmod +x /etc/init.d/rjsupplicant.sh 3.1.2 inform_ipaddr.shsudo vim /etc/init.d/inform_ipaddr.sh #!/bin/bash echo `ifconfig | grep -i "inet addr"` | mail -s dl_machine_ipaddr mailaddr@qq.com sudo chmod +x /etc/init.d/inform_ipaddr.sh Be sure you have installed sendmail tool. More details here. 3.2 Add scripts to autostartsudo vim /etc/xdg/autostart/rjsupplicant.desktop [Desktop Entry] Type=Application Name=rjsupplicant Comment=Log in RuiJie Exec=/etc/init.d/rjsupplicant.sh NoDisplay=false sudo vim /etc/xdg/autostart/inform_ipaddr.desktop [Desktop Entry] Type=Application Name=inform_ipaddr Comment=Tell about IP address using e-mail Exec=/etc/init.d/inform_ipaddr.sh NoDisplay=false 3.3 Testsudo reboot Done. (编辑:莱芜站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- py-faster-rcnn配置运行faster_rcnn_end2end—VGG_CNN_M_10
- Ubuntu 14.04 64安装flash player
- 基于PowerShell在Ubuntu系统的使用详解
- Ubuntu16.04 + cuda8.0 + GTX1080 + matlab14.04a + Opencv
- 【问题收录】Ubuntu14.04安装时黑屏处理
- 在 Ubuntu 14.04 Trusty 中 安装Adobe Reader
- 【问题收录】[ubuntu]startx doesnt work
- ffmpeg的ubuntu的编译过程(编译静态库和动态库)
- Ubuntu14.04下安装wechat(微信)
- 【问题收录】Ubuntu Starting LightDM Display Manager fai
推荐文章
站长推荐
热点阅读