Guest pablik Posted May 6, 2017 Share Posted May 6, 2017 Witam, chciałem dodać wykonanie zadania przez Crona, lecz tu nie ma pliku crontab, utworzyłem taki sam jak w debianie wstawiłem go do /etc/ przewaliłem crona lecz nie działa. Może tu gdzie indziej przechowany jest plik cronetab lub zadania są przechowywane w innym pliku ??? cat /etc/crontab # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 25 * * * * root /root/skrypt.py & Quote Link to comment Share on other sites More sharing options...
tux Posted May 6, 2017 Share Posted May 6, 2017 A może tak zrobić po ludzku jak się powinno to robić? cronteb -e {ENTER} Quote Link to comment Share on other sites More sharing options...
Guest pablik Posted May 6, 2017 Share Posted May 6, 2017 Dalej nie działa, wywaliłem ten mój plik, dodałem wpis przez crontab -e, następnie /etc/init.d/cron restart i nic ;( # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 53 * * * * root /root/skrypt.py Quote Link to comment Share on other sites More sharing options...
tux Posted May 6, 2017 Share Posted May 6, 2017 To teraz pytanie...Czy z palca plik uruchamia się. Coś mi się wydaje, że pliki pytona inaczej się wykonuje. Nie wiem co jest w tym pliku. Quote Link to comment Share on other sites More sharing options...
ipro Posted May 6, 2017 Share Posted May 6, 2017 Dalej nie działa, wywaliłem ten mój plik, dodałem wpis przez crontab -e, następnie /etc/init.d/cron restart i nic ;( Sprawdź, czy skrypt ma uprawnienia do wykonywania (lub wykonaj w ciemno "chmod +x" na pliku). Dodatkowo, w pierwszej linii skryptu powinieneś mieć deklarację interpretera, w stylu: #! /usr/bin/env python Quote Link to comment Share on other sites More sharing options...
Guest pablik Posted May 6, 2017 Share Posted May 6, 2017 Tak, jeśli uruchomię skrypt /root/skrypt.py to działa normalnie. Coś jest nie tak z cron'em ponieważ zmieniłem zdanie na utworzenie pliku lecz go nie tworzy: # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 12 * * * * root touch /root/test Quote Link to comment Share on other sites More sharing options...
ipro Posted May 6, 2017 Share Posted May 6, 2017 A spróbuj usunąć początkową spację z wiersza: 12 * * * * root touch /root/test Quote Link to comment Share on other sites More sharing options...
Guest pablik Posted May 6, 2017 Share Posted May 6, 2017 Dalej nic: # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 20 * * * * root touch /root/test Quote Link to comment Share on other sites More sharing options...
tux Posted May 6, 2017 Share Posted May 6, 2017 /etc/crontab: system-wide crontab A to to po co? Quote Link to comment Share on other sites More sharing options...
Guest pablik Posted May 6, 2017 Share Posted May 6, 2017 Nie wiem ja tego pliku nie tworzyłem Scalono wiadomość: [time]1494100525[/time] Chyba mam rozwiązanie, coś musiałem namieszać z plikiem bo przeinstalowałem softa i całkiem inaczej wygląda, sprawdzę teraz i dam znać czy wszystko jest ok. Tak, działa już poprawnie, wstawie tu orginał może komuś sie przyda. # ----- -------------- # minute 0-59 # hour 0-23 # day of month 1-31 # month 1-12 (or names, see below) # day of week 0-7 (0 or 7 is Sunday, or use names) SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root NICE=15 # run-parts */1 * * * * /bin/run-parts /etc/cron/minutely 01 * * * * /bin/run-parts /etc/cron/hourly 02 5 * * * /bin/run-parts /etc/cron/daily 03 2 * * 0 /bin/run-parts /etc/cron/weekly 04 3 1 * * /bin/run-parts /etc/cron/monthly # your corntabs Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.