0

I have a script which I want to run from init.d in Raspberry Pi, I put the script in rc5.d to make it executed when runlevel 5 is being run, with order number of 20. (S20myscript)

Inside my script I used cat and grep command.

When I reboot the raspberry, it print out error similar to these :

sh: 1: cat: not found

sh: 2: grep: not found

But, If I put it in rc.local. It works. But, I don't want to put it in rc.local. I find that it's not neat,.... Also, in my experiences sometimes it won't run if I put it in rc.local.

I suspected that it is because the cat and grep commands are not ready yet ? But runlevel 5 is the last level right ?

This makes me wonder what runlevel did rc.local run on...

Please let me know if I missed something.

Community
  • 1
  • 1
Lyn
  • 507
  • 3
  • 15
  • This question is about Linux init. You may be able to get help on [Unix & Linux](https://unix.stackexchange.com) or [Super User](http://superuser.com/about) – Matt Oct 26 '17 at 06:29
  • Sorry, I though stackoverflow is just for anything – Lyn Oct 26 '17 at 06:49

1 Answers1

0

Silly of me..

In my script, I redefined the PATH variable.

So, it never find the grep and cat command.

Change the variable name and it works now.

Lyn
  • 507
  • 3
  • 15