- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- need to create symbolic link
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2010 05:32 PM
тАО06-14-2010 05:32 PM
need to create symbolic link
i would looking a small script which can execute through crontab which can check at particular path a symbolic link is present or not if its not present it will create and send email if its present do nothing.
below is the example
here is named net source is /etc/netplug
scrip will execute through crontab and check this sym link is present or not if its not present it will create it and send email to particular users and if its present do nothing..
lrwxrwxrwx 1 root root 12 Jun 15 09:25 net -> /etc/netplug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2010 07:02 PM
тАО06-14-2010 07:02 PM
Re: need to create symbolic link
You can create a script and run this script in crontab with particular interval say 15 min:
1. The cron entry would be looks like this:
You can add using $ crontab -e
It will run every 15 min:
15 * * * * /home/dir/sym_link_chk.sh > /dev/null
2. the script :
/hom/dir/sym_link_chk.sh would like this:
#!/usr/bin/sh
# Checking symlink /etc/netplug
EMAIL=email@domain.com
create_and_send_email () {
net_dir=
cd $net_dir
ln -s /etc/netplug net
ls -l net > net_checked.out
cat net_checked.out | mailx -s "symlink created and net_checked OK" $EMAIL
}
[ -L cal_2k ] && echo "OK : Do nothing:" || create_and_send_email
############################################
Enjoy , Have fun!,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2010 07:30 PM
тАО06-14-2010 07:30 PM
Re: need to create symbolic link
again!,
Correction: cd & Link file name fixed ,
2. the script :
/hom/dir/sym_link_chk.sh would like this:
#!/usr/bin/sh
# Checking symlink /etc/netplug
EMAIL=email@domain.com
create_and_send_email () {
net_dir=
cd $net_dir
ln -s /etc/netplug net
ls -l net > net_checked.out
cat net_checked.out | mailx -s "symlink created and net_checked OK" $EMAIL
}
cd
[ -L net ] && echo "OK : Do nothing:" || create_and_send_email
################################################
* Remember to asign points once resolved and before closing the thread.. Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2010 08:54 PM
тАО06-14-2010 08:54 PM
Re: need to create symbolic link
I'd probably do something more like:
temp_file="/tmp/net_$$_checked.out"
echo 'Created link:' > $temp_file
pwd >> $temp_file
ls -l net >> $temp_file
date >> $temp_file
[Send the e-mail message...]
rm $temp_file
> * Remember to asign points [...]
Don't forget to deduct points for errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2010 09:02 PM
тАО06-14-2010 09:02 PM
Re: need to create symbolic link
> * Remember to asign points [...]
>> Don't forget to deduct points for errors.
You are a cool admin, appreciate it..!
(0 pts. for this pls.)