0%

Ubuntu 14.04开机启动项设置

因为自己的电脑做了服务器,偶尔会关机给电脑休息,每次开机都要手动启动服务程序很麻烦,所以偷懒加到linux的开机启动项中。

命令:

1
$nano -W /etc/rc.local

修改配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

这里加上要启动的程序的绝对路径:

1
2
3
/usr/bin/python /home/orin-c/host/zhujiwu.py

exit 0

Ctrl + X

Enter+Enter