linux启动执行某个脚本

  1. 如果是开机马上执行的脚本,可以将脚本写到rc.local中;

  2. 如果是用户登录后自动执行脚本,可以将脚本写到相应的用户目录下“~/.bash_profile”,若脚本“~/.bash_profile”不存在,可以直接拷贝“/etc/profile”命名为“~/.bash_profile”;

  3. 如果是要任一用户登录后自动执行脚本,可以将脚本写到“/etc/profile”中。

原文地址:https://www.cnblogs.com/ManMonth/p/4818341.html