Ola galera...
Estou com um problema aqui:
tenho 1 script:
#!/bin/bash
echo "DATA - " `date "+%d/%m/%y - %T"` >> logs.txt
echo "CPU e GPU" >> logs.txt
echo `sensors` >> logs.txt
echo "Temp HDS" >> logs.txt
echo `hddtemp /dev/sda` >> logs.txt
echo `hddtemp /dev/sdb` >> logs.txt
echo `hddtemp /dev/sdc` >> logs.txt
echo `hddtemp /dev/sdd` >> logs.txt
Quando executo ele com ./tp.sh e depois leio o arquivo logs.txt, toda a saída está perfeita...
Quando ele executa pelo crontab, as ultimas 5 linhas saem em branco ... ( echo `hddtemp /dev/sda` >> logs.txt)
O que já tentei:
Já criei variáveis e passei estes comandos como valores para imprimir as variáveis diretamente...NADA
Já criei alias destes comandos pelo .bashrc e tentei imprimir... NADA
De tudo o que foi testado, quando executo manualmente (./tp.sh) o comando funciona e escreve no arquivo do jeitim que eu preciso, mas com o crontab, fica em branco...
SAÍDA do comando (rodando manualmente)
DATA - 25/06/21 - 01:49:21
CPU e GPU
amdgpu-pci-0300 Adapter: PCI adapter vddgfx: +0.69 V fan1: N/A (min = 0 RPM, max = 6900 RPM) edge: +28.0°C (crit = +97.0°C, hyst = -273.1°C) power1: 4.02 W (cap = 35.00 W) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +30.0°C (high = +74.0°C, crit = +84.0°C) Core 0
: +27.0°C (high = +74.0°C, crit = +84.0°C) Core 1: +29.0°C (high = +74.0°C, crit = +84.0°C) Core 2: +30.0°C (high = +74.0°C, crit = +84.0°C) Core 3: +27.0°C (high = +74.0°C, crit = +84.0°C) Core 4: +30.0°C (high = +74.0°C, crit = +84.0°C) Core 5: +29.0°C (high = +74.0°C,
crit = +84.0°C)
Temp HDS
/dev/sda: Seagate BarraCuda Q1 SSDZ 2A04VC0100 1 �: 33°C
/dev/sdb: ST8000DM004-2CX188: 35°C
/dev/sdc: WDC WD60EZRZ-00GZ5B1: 31°C
/dev/sdd: KINGSTON SUV400S37120G: 31°C
SAÍDA do comando (rodando crontab)
DATA - 25/06/21 - 01:49:21
CPU e GPU
amdgpu-pci-0300 Adapter: PCI adapter vddgfx: +0.69 V fan1: N/A (min = 0 RPM, max = 6900 RPM) edge: +28.0°C (crit = +97.0°C, hyst = -273.1°C) power1: 4.02 W (cap = 35.00 W) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +30.0°C (high = +74.0°C, crit = +84.0°C) Core 0
: +27.0°C (high = +74.0°C, crit = +84.0°C) Core 1: +29.0°C (high = +74.0°C, crit = +84.0°C) Core 2: +30.0°C (high = +74.0°C, crit = +84.0°C) Core 3: +27.0°C (high = +74.0°C, crit = +84.0°C) Core 4: +30.0°C (high = +74.0°C, crit = +84.0°C) Core 5: +29.0°C (high = +74.0°C,
crit = +84.0°C)
Temp HDS
arquivo crontab:
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
* * * * * /root/tp.sh
(ja tentei:
* * * * * root ./tp.sh
* * * * * ./tp.sh
* * * * * /root/tp.sh
e nada... sempre o mesmo resultado)
detalhes: logado como root, e caminho dos 2 arquivos /root/tp.sh e /root/logs.txt
Esta maquina não tem outro usuário. Esta maquina esta rodando proxmox.
Até dois dias funcionava... não sei o que modifiquei, e não consigo encontrar meu erro!!!
Muito obrigado pela ajuda !!!