这可能是一个重复的问题,但我找不到正确的方法来做到这一点。
我的情况是什么?->我想运行一个 Python 脚本。
python 脚本的作用是什么?->python 脚本运行以设置虚拟专用网络。
我目前如何手动启动它?->我使用 ./file.py start (这有效)
什么不工作?->当我尝试在开始(引导)中开始时,它什么也不做。我正在使用根本不起作用的 cron 作业,我不想使用它,我想使用 /etc/init.d/ 。
这是我在 /etc/init/xxx.conf 中的 file.conf
description "file start script"
author "sijan <sijanshrestha2@gmail.com>"
exec python file.py start
exec sleep 10
exec ifconfig ip0 11.0.2.251
exec ip=`ifconfig ip0 | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
exec echo $ip >>/tmp/ip.log
Run Code Online (Sandbox Code Playgroud)
我在 /etc/init.d/file.py 中添加了 python 文件
我可能没有遵循正确的程序来执行此操作,因为我对系统级别非常陌生,但是非常感谢有关如何进行的任何想法。我非常渴望解决这个问题并学习
我只是想知道我的系统启动所需的时间。在 Arch Linux 中有类似systemd-analyze.
Ubuntu 中的替代方案是什么?