Restart Apache in Lightsail Terminal

10.4k views Asked by At

As I found a blocker in one approach to make a Django app production ready I've gone with a different approach documented here.

In particular, this question is about this step where it says «Restart Apache for the changes to be taken into effect» and has the following associated command

sudo /opt/bitnami/ctlscript.sh restart apache

Thing is, ctlscript.sh isn't in that folder but in /opt/bitnami/stack. Then, when running in that forder

sudo ctlscript.sh restart apache

I get this error

sudo: ctlscript.sh: command not found

Lightsail restart Apache

The file is there so I thought it would be something related with permissions (as pointed here).

The script is in the right folder, so the problem points to incorrect permissions.

sudo chmod 755 ctlscript.sh

but running the command to restart Apache got me into the same "command not found" error.

Lightsail can't restart Apache

2

There are 2 answers

2
Mark B On BEST ANSWER

"command not found" does not point to "incorrect permissions". You're getting errors because the script is not in your PATH. There's two ways you can go this

  1. Discover and specify the full path.
  2. Specify the current directory.

Method 1

Run

pwd

and you will get the full path. If you get /home/bitnami/stack, then, run

sudo /home/bitnami/stack/ctlscript.sh restart apache

Amazon Lightsail restart Apache


Method 2

Run

sudo ./ctlscript.sh restart apache

and that will work too

Amazon Lightsail restart Apache

0
Jaytrix On

The following worked for me (I was getting a command not found error too):

sudo /opt/bitnami/ctlscript.sh restart apache

Taken from https://docs.bitnami.com/aws/faq/administration/control-services/