Bash script help
Hello,
I need assistance making a bash script that searches for current logged on members for FTP. I would like to be notified in e-mail when a user logs on. I tried something on my own and it didn't work. Below is my code. Thank you for any help. Code:
#!/bin/bash |
What were the symptoms of "didn't work"?
What is the output of Code:
ls /home | grep -v /home Code:
username=(`ls /home | grep -v /home`) Code:
username=(`ls /home | grep -v /home`) |
Quote:
Code:
userA Quote:
command output: Code:
grep: userB: No such file or directory Quote:
command output: Code:
grep UserA UserB UserC UserD UserE [...] |
Quote:
You could save a sample lsof output into a file Code:
lsof -ni TCP:21 > my_test.input Code:
cat my_test.input | grep <grep options> That general technique, of experimenting with command formats at the command line, is a powerful way to establish what can later be programmed into a script. If you get stuck, ask again and post what you have tried. |
Thanks catkin. I think I got it to work. :)
Code:
#!/bin/bash |
Quote:
A few caveats regards running a script tested at the command line from cron:
Code:
#!/bin/bash
|
Thanks cakin.
The script works fine when I run it from the command, but when I put it in crontab and STDOUT > /dev/null STDERROR 2>&1 , it's doesn't run. Please help. Crontab entry: Code:
*/5 * * * * /bin/bash /var/scripts/ftp.sh > /dev/null 2>&1 |
Please post the script.
|
All times are GMT -5. The time now is 12:20 AM. |