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