Home  >  Q&A  >  body text

linux - 关于守护进程处理任务

百度了一下,一般守护进程的工作形式是:监听端口,有数据来了就fork()子进程对数据进行处理。

小弟现在需要编写一个分布式任务处理的程序,这个任务手工执行的方式是:
1、普通用户登录server;
2、手动加载profile以及挂载网络文件系统;
3、执行程序(因为程序在NFS上面才有)。

这种任务执行方式,怎么用守护进程实现呢?毕竟手工执行任务需要以普通用户身份登录控制终端,而守护进程属于超级用户,并且是不属于某个控制终端的。
问题是守护进程怎么模拟任务手工执行这三个步骤?因为这个任务需要某个用户控制终端所属的进程来执行。

大家讲道理大家讲道理2717 days ago360

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:45:45

    I don’t understand what you mean. Port monitoring does not distinguish between user permissions. Ordinary users can also send sockets to daemons created by super users. I don’t know where you can’t figure it out.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:45:45

    The above two parts can be done with shell programming
    I won’t go into details if ssh is configured and used to log in with a certificate.
    Ssh can be followed directly by the file name, which is to execute a certain command after the login is completed
    As for hanging on the network file system and executing a specific program, it can be written in the command script executed when logging in

    reply
    0
  • Cancelreply