Ubuntu รองรับ@reboot
crontab หรือไม่
ฉันพบเอกสารที่แนะนำว่ารองรับ แต่การแช็ทผ่านเว็บไม่สามารถทำได้
ฉันไม่สามารถทำให้@reboot
ส่วนทำงานได้ ส่วน "หลังเที่ยงคืน" ใช้งานได้ดี
นี่คือตัวอย่างทดสอบจากฉัน/etc/crontab
:
$ cat /etc/crontab
# /etc/crontab: system-wide crontab
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
##
# in the beginning -
@reboot /var/kiosk/btest.sh
# after midnight
30 0 * * * root /etc/cron.daily/kiosk/kioskReboot.sh
# end of crontab
เชลล์สคริปต์ btest.sh
#!/bin/bash
date > /var/kiosk/STARTFLAG.txt
echo we booted >> /var/kiosk/STARTFLAG.txt
date
echo we booted
สิทธิ์
$ ls -l btest.sh
-rwxrwxrwx 1 root root 147 Aug 21 15:19 btest.sh
$ ls -ld
drwxrwxrwx 14 laptopsanytime root 4096 Aug 21 16:30 .
คุณคิดเกี่ยวกับการสร้างสคริปต์ btest.sh, autostart askubuntu.com/a/9388/2973
—
wojox
มีคำตอบที่ยอดเยี่ยมเกี่ยวกับ Unix & Linux ' [crontab's @reboot ใช้สำหรับ root เท่านั้น]] [1] [1]: unix.stackexchange.com/q/109804/17362
—
Édouard Lopez
ฉันมีใน crontab ส่วนตัวของฉัน @reboot กฎที่ใช้งานได้โอเคลักษณะเช่นนี้:
—
taneli
@reboot sh /home/me/run-stuff.sh
ในกรณีที่ไม่มีใครได้รับมันเขากำลังผสม crontabs: / etc / crontab เป็นผู้ใช้ crontab และต้องการผู้ใช้ crontab -e เป็น crontab ส่วนบุคคลและใช้ผู้ใช้ที่มีการใช้งานในขณะที่แก้ไขดังนั้นไม่จำเป็นต้องมีชื่อผู้ใช้ ทั้งสองยอมรับ @reboot
—
Rinzwind