• Background: For some bound ports, you need to run the IP address operation with root permission
# automation, who would type sudo xx in the fieldCopy the code
  • Procedure 1 Prepare the startMediaserver.sh startup script
# StartMediaServer.sh
sudo chown root ./MediaServer
sudo ./MediaServer
Copy the code
  • 2 Manually assign root permission to the startup script
sudo chown root StartMediaServer.sh
Copy the code
  • 3 can also be done in one step, a script
#! /usr/bin/expect spawn su root expect "Password:" send "xx\r" send "cd / home/username/projects/ZLMediaKit/release/Linux/Releas \ r "send". / MediaServer \ r "expect eof the exitCopy the code
  • The premise is to expect
apt-get install expect
Copy the code