linux下使用nohup记录命令打印信息

2010-01-26  菜菜 

    大家都知道nohup就是不挂起的意思( no hang up)。
    但是无论是否将 nohup 命令的输出重定向到终端,输出都将附加到当前目录的 nohup.out 文件中。
    如果当前目录的nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中。如果没有文件能创建或打开以用于追加,那么 Command参数指定的命令不可调用。如果标准错误是一个终端,那么把指定的命令写给标准错误的所有输出作为标准输出重定向到相同的文件描述符。
    说了那么多,直接放命令简单的多,呵呵
app/bin>nohup ./startService.sh
Sending output to nohup.out

可以查看app/bin>tail -f nohup.out
2010-01-24 16:49:48,467 [main] INFO  - skip.
2010-01-24 16:49:48,467 [main] INFO  - Check upgrade patches finished.
2010-01-24 16:49:54,246 [main] INFO  - Server rmi dynamic port is restricted on
6010
2010-01-2416:49:54,760 [main] INFO  - App register: App1262854194733
2010-01-24 16:49:55,349 [main] INFO  - Init model start...

当然也可以知道输出:
另外指定了输出文件:
nohup [command] > out.file 
895°/8935 人阅读/2 条评论 发表评论

王恩建  2010-01-26

才疏学浅,才知道这个,man了一把:
nohup - run a command immune to hangups, with output to a non-tty


王波  2010-01-26

羡慕你们用linu的,可以学习linxu的只是,我们都用windows


登录 后发表评论