Automated Debian Script

Status
Not open for further replies.

Eagle2469

Bronze Partner
Advanced Certified
Joined
Aug 6, 2018
Messages
35
Reaction score
4
Hello,

I am trying to create a script that I can use to automate the shell install of 3CX.

Here is what I have so far.
Bash:
#!/bin/sh


apt-get update
apt-get --with-new-pkgs upgrade -y

# Install 3cxpbx
wget -O- http://downloads-global.3cx.com/downloads/3cxpbx/public.key | apt-key add -
echo "deb http://downloads-global.3cx.com/downloads/debian stretch main" | tee /etc/apt/sources.list.d/3cxpbx.list
apt-get update
apt-get -y install net-tools dphys-swapfile
#apt-get -y install 3cxpbx

I have the last line commented out, as it always stops before completing if there is no user input. It asks for license to be accepted and then the following.
Screenshot 2020-11-12 221821.png

Is there a way to accept license and choose option 1 automatically? Something like a one line command?

Example
acceptlicense=y runtool=1 apt-get -y install 3cxpbx

Thanks!
 

Thank you. Although that looks really handy and I will bookmark it in case it is ever needed, it doesn't solve my issue. I am not trying to automate the entire setup. I am just trying to deploy a VPS that already has 3CX installed with my provider. This way all I need to do is go to http://ipaddress:5015 and fill in the blanks. So, I just need a way to apt-get install 3cxpbx without being asked any questions.
 
Maybe, this isn't possible?
 
The link @cobaltit posted is the only way.
 
Since you're happy working with shell scripts - look into a command line tool called "expect".
Expect allows you to watch for a specific text string and responding accordingly.

This tutorial link covers installing and basic examples, and covers another useful side-tool autoexpect which will allow you to run the application normally and capture the output/responses and build you the expect script you can use later to then automate.
 
  • Like
Reactions: cyberspot
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,990
Messages
590,163
Members
164,926
Latest member
tohoken1