Termux bashrc

26-05-23 20:05 simon

This took some working out but this checks if the SSH server and VNC are running, it starts the ssh server if needed and gives the option to kill the vnc server(s).

#------------------------------------------
alias l='ls -lh'
alias ll='ls -lah'
alias la='ls -a'

alias grep='grep --color=auto'
alias rel='termux-reload-settings'

#------------------------------------------

if [[ $(pidof sshd) ]]; then
    echo -e "\\n[!] SSH server Already Running."

else
    echo -e "\\n[*] Starting SSH Server..."
    sshd &
fi
if [[ $(pidof Xvnc) ]]; then
echo -e "\\n[!] VNC server Already Running."
{ vncserver -list; echo; }
read -p "Kill VNC Server? (Y/N) : "
    if [[ "$REPLY" == "Y" || "$REPLY" == "y" ]]; then
        { for VNC in {0..10}; do vncserver -kill :$VNC; done }
    else
        echo
    fi
else
    echo -e "\\n[*] Starting VNC Server..."
    vncserver 
fi
ifconfig | grep 192