Different Result using ps -efW (Manual & Cron)

Jun Iriola juniriola@yahoo.com
Thu Jun 20 08:33:00 GMT 2013


Hi,

I made a simple script that should detect if a certain service is running or not.  Said script will run via cron.

When I tested it and executed it manually in the command prompt, it list all Cygwin and Windows processes. But when I put it in cron, the number of services detected were not the same. Account used is the same during manual execution and also on cron.

To get the list of services, I use this command /usr/bin/ps -efW.

Do you have any idea why such behavior?  Help is very much appreciated.  Thanks.

Regards,

Jun

====================================================================
Result via manual run

     UID     PID    PPID  TTY        STIME COMMAND
 jvi3147    5804    2192 pty2     16:12:50 /usr/bin/ps
cyg_serv    4304    4844 ?        17:53:46 /usr/sbin/sshd
cyg_serv    5964    4304 ?        10:16:27 /usr/sbin/sshd
 jvi3147    2192    5964 pty2     10:16:41 /usr/bin/bash
 jvi3147    5204       1 ?        11:41:02 /usr/bin/mintty
 jvi3147    4880    5204 pty0     11:41:02 /usr/bin/bash
cyg_serv    4024    4304 ?        15:09:27 /usr/sbin/sshd
cyg_serv    1652    4304 ?        09:08:35 /usr/sbin/sshd
cyg_serv    2108    6088 ?        17:55:14 /usr/sbin/cron
cyg_serv    4844       1 ?        17:53:46 /usr/bin/cygrunsrv
cyg_serv    6088       1 ?        17:55:14 /usr/bin/cygrunsrv
       0       4       0 ?          Mar 28 System
       0     412       0 ?          Mar 28 C:\Windows\System32\smss.exe
       0     480       0 ?          Mar 28 C:\Windows\System32\csrss.exe
       0     532       0 ?          Mar 28 C:\Windows\System32\wininit.exe
       0     608       0 ?          Mar 28 C:\Windows\System32\services.exe
       0     620       0 ?          Mar 28 C:\Windows\System32\lsass.exe
       0     628       0 ?          Mar 28 C:\Windows\System32\lsm.exe
       0     788       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0     852       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0     932       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0     984       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    1000       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    1024       0 ?          Mar 28 C:\Windows\System32\SLsvc.exe
       0    1068       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    1128       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    1484       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    1628       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    1728       0 ?          Mar 28 C:\Windows\System32\spoolsv.exe
       0    2008       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    2020       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0     300       0 ?          Mar 28 C:\Program Files\Sophos\Remote Management System\ManagementAgentNT.exe
       0     424       0 ?          Mar 28 C:\Program Files\Sophos\AutoUpdate\ALsvc.exe
       0     796       0 ?          Mar 28 C:\Program Files\Sophos\Remote Management System\RouterNT.exe
       0     680       0 ?          Mar 28 C:\Windows\System32\taskeng.exe
       0    2060       0 ?          Mar 28 C:\Program Files\VMware\VMware Tools\vmtoolsd.exe
       0    2184       0 ?          Mar 28 C:\Program Files\VERITAS\VxPBX\bin\pbx_exchange.exe
       0    2260       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    2296       0 ?          Mar 28 C:\Program Files\VERITAS\NetBackup\bin\vnetd.exe
       0    2500       0 ?          Mar 28 C:\Program Files\VMware\VMware Tools\VMUpgradeHelper.exe
       0    2532       0 ?          Mar 28 C:\Program Files\VERITAS\NetBackup\bin\bpinetd.exe
       0    2704       0 ?          Mar 28 C:\Program Files\VERITAS\NetBackup\bin\bpcd.exe
       0    2928       0 ?          Mar 28 C:\Windows\System32\dllhost.exe
       0    3028       0 ?          Mar 28 C:\Windows\System32\msdtc.exe
       0    3360       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    3700       0 ?          Mar 28 C:\Windows\System32\svchost.exe
       0    2224       0 ?          Apr  1 C:\Windows\System32\csrss.exe
       0    1956       0 ?          Apr  1 C:\Windows\System32\winlogon.exe
       0     944       0 ?          Apr  1 C:\Windows\System32\LogonUI.exe
       0    3292       0 ?          Jun  4 C:\Program Files\OCS Inventory Agent\OcsService.exe
       0    4856       0 ?          Jun 12 C:\Program Files\Sophos\Sophos Anti-Virus\SavService.exe
       0    6120       0 ?          Jun 12 C:\Program Files\Sophos\Sophos Anti-Virus\SAVAdminService.exe
       0    4372       0 ?          Jun 12 C:\Program Files\Sophos\Sophos Anti-Virus\sdcservice.exe
       0    4400       0 ?          Jun 12 C:\Program Files\Sophos\Sophos Anti-Virus\Web Intelligence\swi_service.exe
       0    4424       0 ?        18:10:12 C:\Windows\System32\csrss.exe
       0    2440       0 ?        18:10:12 C:\Windows\System32\winlogon.exe
       0    1076       0 ?        18:10:17 C:\Windows\System32\taskeng.exe
       0    2912       0 ?        18:10:17 C:\Windows\System32\rdpclip.exe
       0    2148       0 ?        18:10:21 C:\Windows\System32\dwm.exe
       0    5716       0 ?        18:10:21 C:\Windows\explorer.exe
       0    2864       0 ?        18:10:22 C:\Program Files\VMware\VMware Tools\VMwareTray.exe
       0    5768       0 ?        18:10:22 C:\Program Files\Sophos\AutoUpdate\ALMon.exe
       0    4824       0 ?        18:10:27 C:\Windows\System32\mmc.exe
       0     384       0 ?        18:11:13 C:\Windows\System32\Netplwiz.exe
       0    5652       0 ?        11:40:17 C:\Windows\System32\mmc.exe
       0    4056       0 ?        11:40:38 C:\Windows\System32\taskmgr.exe
       0    2144       0 ?        11:56:25 C:\Windows\System32\LogonUI.exe


Result via cron


      UID     PID    PPID  TTY        STIME COMMAND
 cyg_serv    4304    4844 ?        17:53:46 /usr/sbin/sshd
 cyg_serv    5964    4304 ?        10:16:27 /usr/sbin/sshd
  jvi3147    2396    5532 ?        16:14:02 /usr/bin/ps
  jvi3147    2192    5964 pty2     10:16:41 /usr/bin/bash
  jvi3147    5204       1 ?        11:41:02 /usr/bin/mintty
  jvi3147    4880    5204 pty0     11:41:02 /usr/bin/bash
 cyg_serv    4024    4304 ?        15:09:27 /usr/sbin/sshd
 cyg_serv    5692    2108 ?        16:14:01 /usr/sbin/cron
 cyg_serv    1652    4304 ?        09:08:35 /usr/sbin/sshd
  jvi3147    5532    5692 ?        16:14:01 /usr/bin/sh
 cyg_serv    2108    6088 ?        17:55:14 /usr/sbin/cron
 cyg_serv    4844       1 ?        17:53:46 /usr/bin/cygrunsrv
 cyg_serv    6088       1 ?        17:55:14 /usr/bin/cygrunsrv
        0    1076       0 ?        18:10:17 \Device\HarddiskVolume1\Windows\System32\taskeng.exe
        0    2912       0 ?        18:10:17 \Device\HarddiskVolume1\Windows\System32\rdpclip.exe
        0    2148       0 ?        18:10:21 \Device\HarddiskVolume1\Windows\System32\dwm.exe
        0    5716       0 ?        18:10:21 \Device\HarddiskVolume1\Windows\explorer.exe
        0    2864       0 ?        18:10:22 \Device\HarddiskVolume1\Program Files\VMware\VMware Tools\VMwareTray.exe
        0    5768       0 ?        18:10:22 \Device\HarddiskVolume1\Program Files\Sophos\AutoUpdate\ALMon.exe
        0    4056       0 ?        11:40:38 \Device\HarddiskVolume1\Windows\System32\taskmgr.exe  

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list