Как я могу получить неограниченную информацию от pstree?

Я использую pstree смотреть последовательность скриптов и даже при использовании -plaЯ получаю сокращенные версии аргументов и имен сценариев. В качестве примера:

sshd,13431
  └─bash,13432
      └─runJobs.sh,18780 ./runJobs.sh
          └─job1.sh,18781 ./job1.sh /path/to/location/of/some/file/that/I/need/to/see/file1.txt /path/to/the/location/of/some/other/file/that/I/need/to/see/file2.txt /path/to/yet/another/location/of/some/other/file/that/I/also/need/to/see/file3.txt/yet/another/long/path/to/a/4th/locatio
              └─veryLongNameFor,18782 ./veryLongNameForJob2.sh Argument1_is_very_long arg2_is_also_quite_long The_name_for_arg3_is_even_longer
                  └─sleep,18783 1000

Как вы видете verLongNameForJob2.sh урезан, я не получаю полный путь для /yet/another/long/path/to/a/4th/location/that/I/need/to/lookAt/file4.txt и я тоже получаю /path/to/yet/another/location/of/some/other/file/that/I/also/need/to/see/file3.txt соединенный с /yet/another/long/path/to/a/4th/location/that/I/need/to/lookAt/file4.txt, Как я могу получить полные имена сценариев вместе с полными именами аргументов без объединения, даже если они очень длинные?

Ниже приведены сценарии, которые я использовал для этого:

runJobs.sh:

#!/bin/bash
### contents of 'runJobs.sh'

arg1=/path/to/location/of/some/file/that/I/need/to/see/file1.txt
arg2=/path/to/the/location/of/some/other/file/that/I/need/to/see/file2.txt
arg3=/path/to/yet/another/location/of/some/other/file/that/I/also/need/to/see/file3.txt
arg4=/yet/another/long/path/to/a/4th/location/that/I/need/to/lookAt/file4.txt

./job1.sh $arg1 $arg2 $arg3 $arg4

job1.sh:

#!/bin/bash
### contents of job1.sh

arg1=Argument1_is_very_long 
arg2=arg2_is_also_quite_long
arg3=The_name_for_arg3_is_even_longer

./veryLongNameForJob2.sh $arg1 $arg2 $arg3

veryLongNameForJob2.sh:

#!/bin/bash
### contents of 'veryLongNameForJob2.sh'

sleep 1000

1 ответ

Я повторил проблему с pstree на моей Ubuntu 16.04.2 LTS. Мне нужны были более длинные пути, но все же.

Инструменты как pstree использование /proc собирать информацию, так что читайте /proc/<PID>/cmdline, Это неудача, если информация там усечена. Но может случиться так, что вы достигнете предела своего pstree только реализация.

В моем случае /proc/<PID>/cmdline не был обрезан, когда я перешел предел pstree ,

Еще одна хорошая новость - аргументы в /proc/<PID>/cmdline разделяются символами NULL (0x00).

Другие вопросы по тегам