ubuntu 16.04 service not found 怎么解决?

落雁西南 2016-10-12 07:09:45
我希望在装了ubuntu16.04系统的树莓派3上开机自启python脚本。
因为在pc的ubuntu14.04上用过service来实现开机自启,所有继续使用这个方法。但是同样的方法在树莓派3的ubuntu16.04上却报了错:Failed to start startport.service:Unit startport.service not found.
startport在/etc/init.d文件夹下
conport.py在/root/project/testpy文件夹下
都用chmod 755授权了的,做法与PC上ubuntu14.04一样,但是树莓派上的就是运行不起来是怎么回事?完全没头绪啊,感觉是ubuntu16.04与14.04的区别造成的,但是像service这样的东西不应该变化太大的呀!
有人能解决吗?或者有更好的方式开机自启?
startport代码:
#!/bin/bash
#chkconfig:2345 80 90
#description:startport
# /etc/init.d/startport
### BEGIN INIT INFO
# Provides: embbnux
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start conport initscript
# Description: This service is used to manage a port
### END INIT INFO
case "$1" in
start)
/root/project/testpy/conport.py &
;;
stop)
killall conport.py
;;
#*)
#
esac
exit 0
...全文
3335 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuhulinfeng 2017-11-29
  • 打赏
  • 举报
回复
对的,是16.04版本升级造成的

23,120

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧