0

I try to start gulp by running /home/m/gulp at the start up Kubuntu 20.04 LTS (from Ubuntu).

It was not possible to run gulp with just one line Console/Terminal:

/home/m/gulp

bash: ./gulp: No such file or directory

That's probably normal.

so i tried successful:

cd /home/m
gulp

Therefore i stored this inside /home/m/gulp.sh SH-Script.

It works as expected if I start it manually by typing /home/m/gulp.sh into the terminal.

I got no results after reboots by these tries:

  1. System Settings > Autostart > Add Script: /home/m/gulp.sh

  2. sudo crontab -e

    crontab -e
    @reboot `/home/m/gulp.sh`
    

I changed the SH-Script, added sudo , and it works now also automatically after reboot:

cd /home/m
sudo gulp

That works for me. BTW It not ask me for Password (configure sudo). But I find it a bit strange that I sometimes need a sudo in the sh script and sometimes not. If I start it via crontab it needs a sudo, if I start it myself (manually) I don't need a sudo.

SL5net
  • 2,282
  • 4
  • 28
  • 44
  • BTW if i try `./gulp` i get `No such file or directory` . `gulp` works – SL5net Sep 28 '20 at 18:10
  • Root's `crontab` uses a different syntax. Is the script executable? Why doesn't running `gulp` with an absolute path work? That sounds like a bug in its own right. – tripleee Sep 28 '20 at 18:33
  • 1
    Your last comment doesn't make sense; can you rephrase please? – tripleee Sep 28 '20 at 18:33
  • I _think_ the Autostart option only starts something when you log in to your desktop, not when the system boots. I haven't used Ubuntu in many years so this could be a red herring, though. – tripleee Sep 28 '20 at 18:41
  • @tripleee if i writ `crontab -l` into terminal is see my script is correct added to the list. – SL5net Sep 28 '20 at 18:48
  • works if i use as sh-script at startup: `cd /home/m sudo gulp`. sudo not needed if i start it manually – SL5net Sep 28 '20 at 18:56
  • Your enumeration shows `sudo` but then inside you don't use `sudo`. Is this in `root`'s `crontab` (by way of `sudo`) or in your own? Does `gulp` need to be run as root? And again, is your script executable? Have you checked the system log for results from `cron`? – tripleee Sep 28 '20 at 19:07
  • Yes, I think there might be something wrong with the system. Today I had to correct an error with sudo of mine like this: https://askubuntu.com/a/471503/1017209 I tried to check whether crontab was working correctly (https://unix.stackexchange.com/questions/274737/how-do- i-know-if-crontab-is-working-fine). But I cannot interpret the result. https://i.stack.imgur.com/nQ37V.png – SL5net Sep 28 '20 at 19:08
  • 1
    https://stackoverflow.com/questions/22743548/cronjob-not-running has a large number of troubleshooting steps. You really need to go through those. – tripleee Sep 28 '20 at 19:08
  • 1
    The `grep` output just shows that `syslog` is configured to log `cron` output. The actual log files are usually in `/var/log/syslog` or similar. And please don't post images of text. – tripleee Sep 28 '20 at 19:09
  • end of `/var/log/syslog` : `06:31 systemd[1]: Started Hostname Service. 07:01 systemd[1]: systemd-hostnamed.service: Succeeded. ` Maybe `Starting Hostname Service` is interesting. hmm – SL5net Sep 28 '20 at 19:16
  • the cron [step 2](https://stackoverflow.com/questions/22743548/cronjob-not-running) test is not working `m@kubuntu:~$ * * * * * /bin/echo "cron works" >> ./temp.txt ` `2020-09-26 02-01-28.mkv: command not found` `m@kubuntu:~$ ls -al ./temp.txt` `-rw-rw-r-- 1 m m 455 Sep 27 12:34 ./temp.txt` . – SL5net Sep 28 '20 at 20:10
  • That looks like you typed that on the command line rather than ran it from `cron`. The command `*` tries to run all the files in your current directory (or, well, the first one with the others as arguments) and the result looks like `./temp.txt` already existed before you ran that command. – tripleee Sep 29 '20 at 05:28
  • `hostname` is a service which tells you what your host name is, and has no meaning here. You want to look for `cron` errors. – tripleee Sep 29 '20 at 05:29

0 Answers0