Hi All,
I’ll start this with I’m a novice at writing these scripts, so it could be something obvious.
I’ve got a bash script worklet mostly working to install the Tanium client to RHEL/CentOS servers, but am running into an issue when it needs to copy a file to a directory created after the install. It seemly does everything else properly when I run it, except copy the tanium-init.dat file. I confirmed it properly extracts it to /tmp from the tarball payload as well. I thought adding the pause may help in case it was trying to copy it before the directory was created, but that doesn’t seem to be the case.
#!/bin/bash
# Copies the tarball to /tmp
scp TaniumClient-7.4.5.1225.tar.gz /tmp
# Extracts the tarball to /tmp
tar xvzf /tmp/TaniumClient-7.4.5.1225.tar.gz -C /tmp
# Installs the Tanium client, outputs install log to /tmp
sudo rpm -i /tmp/TaniumClient-7.4.5.1225-1.rhe7.x86_64.rpm > /tmp/taniumclient_install.log
# Sets the Tanium Client Server info
sudo /opt/Tanium/TaniumClient/TaniumClient config set ServerName *servername*
# Copies the tanium-init.dat to the TaniumClient directory
sleep 15 && sudo cp /tmp/tanium-init.dat /opt/Tanium/TaniumClient/tanium-init.dat
# Enable to the Tanium client service to start at boot then start the service
sudo systemctl enable taniumclient
sudo systemctl start taniumclient