Alias or something that works

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
arimakidd
Level 1
Level 1
Posts: 29
Joined: Thu Nov 02, 2017 11:37 pm

Alias or something that works

Post by arimakidd » Wed Dec 06, 2017 11:15 pm

I have installed apache2 manually, download tar file etc. To start apache2 I have to enter the command

Code: Select all

sudo /etc/local/apache2/bin/apachectl start
Can someone, anyone please help. I just want to type:

Code: Select all

sudo apache start
or

Code: Select all

apache start
I thought putting the location of the apachectl file in the "/etc/environment" file would have worked, but it doesn't. What do I do?

User avatar
Pierre
Level 16
Level 16
Posts: 6416
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Alias or something that works

Post by Pierre » Thu Dec 07, 2017 4:53 am

if you R/click the Desktop, and then on "Create Launcher"
& then browse to /etc/local/apache2/bin/apachectl - - then click on "Start"
- - fill the Text Box's & click OK
- will that then launch the program ?.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

arimakidd
Level 1
Level 1
Posts: 29
Joined: Thu Nov 02, 2017 11:37 pm

Re: Alias or something that works

Post by arimakidd » Thu Dec 07, 2017 2:08 pm

I haven't tried it but just looking at the solution, 'apachectl' requires an argument the arguments are as follows:
start
stop
restart

If I follow your solution would I be able to add those arguments?

User avatar
Flemur
Level 14
Level 14
Posts: 5357
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Alias or something that works

Post by Flemur » Thu Dec 07, 2017 2:26 pm

You could put it in one file, like
~/bin/apache : (check to make sure "apache" is not already used ("which apache") ...and/or use "Apache", etc, instead)

Code: Select all

#!/bin/bash
#
if [ $# -lt 1 ]
then
  echo Usage: `basename $0` pattern
  exit 1
fi
sudo /etc/local/apache2/bin/apachectl $1
Then

Code: Select all

chmod +x ~/bin/apache 
Then

Code: Select all

apache start
etc
or make separate files for the operations, e.g. ~/bin/a-start

Code: Select all

#!/bin/bash
sudo /etc/local/apache2/bin/apachectl start

Code: Select all

chmod +x ~/bin/a-start
Then

Code: Select all

a-start
Edit: OR use an alias in ~/.bashrc:

Code: Select all

alias Apache='/etc/local/apache2/bin/apachectl '
then

Code: Select all

Apache start
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

arimakidd
Level 1
Level 1
Posts: 29
Joined: Thu Nov 02, 2017 11:37 pm

Re: Alias or something that works

Post by arimakidd » Thu Dec 07, 2017 2:31 pm

I have seen similar solution that use a ~bashrc file. This solution looks good but I lack background knowledge to understand it. Can you point me to some reference material so that I can come back and come up to speed on this solution.

Post Reply

Return to “Software & Applications”