su - 用户名 -c 要运行的程序(全路径)

[root@localhost elastic]# su - elsearch -c /home/elastic/elasticsearch-7.1.1/bin/elasticsearch

linux shell脚本中的延时

还是使用 sleep 或usleep函数。

详细如下:

  • sleep : 默认为秒。
    sleep 1s 表示延迟一秒  
    sleep 1m 表示延迟一分钟  
    sleep 1h 表示延迟一小时  
    sleep 1d 表示延迟一天
  • usleep : 默认以微秒。  
    1s = 1000ms = 1000000us

reference

  1. nohup 详解
  2. nohup和&后台运行,进程查看及终止
最后修改:2020 年 02 月 12 日
如果觉得我的文章对你有用,请随意赞赏