I want to compile sass files remotely on my VPS, so I made this init.d script:

# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
# Provides:          sass
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Script used to compile sass
# Description:       Script used to copile sass and scss files
#            directly, running from boot

# Author: Karol K

DESC="Running sass compiler"

And here is start_sass.sh:

sass --watch /var/www:/var/www --style compressed &

Unfortunately, it doesn't work. When I check service sass status I get following:

root@Serwer:~# service sass status -l
● sass.service - LSB: Script used to compile sass
   Loaded: loaded (/etc/init.d/sass)
   Active: active (exited) since Thu 2016-08-11 12:14:50 CEST; 2s ago
  Process: 9777 ExecStop=/etc/init.d/sass stop (code=exited, status=0/SUCCESS)
  Process: 9785 ExecStart=/etc/init.d/sass start (code=exited, status=0/SUCCESS)

Aug 11 12:14:50 Serwer sass[9785]: /media/start_sass.sh: line 2: sass: command not found

System is Debian 8 x64

  • I assume that when you run start_sass.sh directly, it does work? If so, it might be a PATH issue. Try giving the sass binary with full path (like /usr/bin/sass, or wherever it is, check with which sass in your shell). – madeddie Aug 11 '16 at 11:47
  • Heh, i'll make it into the answer for future reference :) – madeddie Aug 11 '16 at 11:58
  • Also I used whereis sass, because I have several files with sass in name and locate gave me very long list... :) – KK2345 Aug 11 '16 at 12:04

It might be an issue with the PATH.

Try using the full path in the script, like /usr/bin/sass.

Find out where the sass binary is located with which sass.

Setting the $PATH variable in the script would also solve it, add this before line before the sass --watch line:

export PATH=$PATH:/directory/where/sass/is_located/

where of course the latter part is replaced with the actual directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.