Ubuntu 22.04:登录时运行脚本 - 启动 VPN

Ubuntu 22.04:登录时运行脚本 - 启动 VPN

我有一个名为startVPN.sh的脚本,我已将其放入.profile文件中。如果我运行bash .profile,该脚本会运行,但它不会在登录时运行。

我该如何修复这个问题以便 VPN 在登录时自动启动?

脚本

#!/bin/bash
nmcli con up id OSG

。轮廓


# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
~/startVPN.sh

相关内容