67
service service_name start

When i tried running this from cmd line, it works. But when i try to schedule it via cron, i get an error saying

/bin/sh: service: command not found

Soviut
  • 88,194
  • 49
  • 192
  • 260
Ash
  • 693
  • 1
  • 6
  • 9

1 Answers1

156

sbin is not in the path when run via cron. Specify the full path to service. This is probably either /sbin/service or /usr/sbin/service. You can find the path on your system by running which service.

Dark Falcon
  • 43,592
  • 5
  • 83
  • 98