Board logo

標題: Ubuntu 16 set program autorun 一問,thx [打印本頁]

作者: CyberSection    時間: 2019-3-22 17:37     標題: Ubuntu 16 set program autorun 一問,thx

本帖最後由 CyberSection 於 2019-3-22 17:50 編輯

我想部機一開機自動行wireshark(或Tshark),我已set 好command 放在Desktop 的wires.sh,及eit 了sudoers行sudo 無需打password,我經terminal 也可以call wires.sh 行到wireshark +autosave output file,但不明為何放落rc.local 或 crontab -e 後,每次開機都冇應,請問應該點set 去autorun 個.sh file ,thx

wires.sh 內容如下:
#!/bin/sh

wireshark -i eth0 -k -b filesize:100000 -b files:100 -w /home/user/Desktop/wire/user.pcap
exit 0

crontab 如下
@reboot /home/user/Desktop/wires.sh


rc.local 內容如下
/home/user/Desktop/wires.sh
作者: samiux    時間: 2019-3-22 19:11

chmod +x /home/user/Desktop/wires.sh

via HKEPC IR Pro 3.5.2 - Android(3.2.0)
作者: t1066    時間: 2019-3-22 19:48

Have you try to use the full path of wireshark, e.g.
/usr/bin/wireshark -i eth0 ... ?
作者: cal22cal    時間: 2019-3-22 21:27

Ubuntu 16 係唔係已經係用 systemd 喇?
作者: CyberSection    時間: 2019-3-23 22:14

thx anyone ,最後原因個rc.local 個permission 唔知點解被改了344
最後行返以下野就autorun 到
sudo chown root /etc/rc.local
sudo chmod 755 /etc/rc.local





歡迎光臨 電腦領域 HKEPC Hardware (https://www.hkepc.com/forum/) Powered by Discuz! 7.2