Skip to main content

Thread: How to make script insert code below certain Words / lines?


well guys, i'm modifying script create multiple users rutorrent.

anyways, need on part.

basically, along code, asked enter port

code:
get_scgi_port() {  	scgi_mount="/rutorrent/$user_name"  	read -p "scgi port: " scgi_port    	while [[ $scgi_port -lt 1024 || $scgi_port -gt 65535 || $scgi_port -eq 5000 ]];  		echo -e "\n${bldred}- invalid port${rst}"  		read -p "scgi port: " scgi_port  	done  }
and along code, port inserted config text file.

code:
httpd_add_scgi() {  	if [[ $webserver = 'lighttpd' ]];  		echo "scgimount $scgi_mount 127.0.0.1:$scgi_port" part needs modified , put below line / word >> /etc/lighttpd/lighttpd.conf  	fi  	sudo -u $user_name echo "network.scgi.open_port = 127.0.0.1:$scgi_port" >> /home/$user_name/.rtorrent.rc  	echo -e "${bldred}-${rst} scgi mount ..........[${bldpur} created ${rst}]"  	echo -e "${bldred}-${rst} scgi port ...........[${bldpur} $scgi_port ${rst}]\n"  }
so can see below, want iput pasted in format, below "scgi.server =(" line. mustn't produce errors in sense running script add more entries, more once. each entries seperated of course.

how output should like:

code:
scgi.server = (  "/var/www/rutorrent/rpc2" => # rt_dir   ( "127.0.0.1" =>    (     "host" => "127.0.0.1",     "port" => 5000,     "check-local" => "disable"    )   ),  "/var/www/rutorrent/rpc3"=>   (     "127.0.0.1" =>    (     "host" => "127.0.0.1",     "port" => 5001,     "check-local" => "disable"    )   )  )



Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [ubuntu] How to make script insert code below certain Words / lines?


Ubuntu

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account