
The Challenge: Reliable Access to Network Shares
Many businesses use Linux servers to host essential applications or services like media streaming, file sharing, or backup systems. These servers often rely on network shares mapped from centralized storage (like a NAS). However, these shares can occasionally disconnect due to network hiccups, maintenance reboots, or unforeseen interruptions. When that happens, your services can experience downtime, causing disruption and productivity loss.

The Solution: Automated Mount Checking and Remounting
At SeraphimGate Systems, we proactively solve this issue using a simple yet powerful automation script. Recently, for a client using an Ubuntu server hosting critical services, we implemented a small bash script combined with a cron job to periodically verify that all essential network shares remain mounted. If a share is found disconnected, the script automatically remounts it, ensuring continuous availability.
Here's an anonymized example of how this automation works:
How It Works: Step-by-Step Automation
Create the Automation Script:We wrote a simple bash script (mount-check.sh) that checks each share defined in the server’s filesystem table (/etc/fstab). If a share isn't mounted, the script attempts a remount and logs the action clearly.
#!/bin/bash
mountpoints=(
"/mnt/smbshare/Share1"
"/mnt/smbshare/Share2"
"/mnt/smbshare/Share3"
)
for mountpoint in "${mountpoints[@]}"; do
if ! mountpoint -q "$mountpoint"; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - $mountpoint disconnected, attempting remount."
mount "$mountpoint"
if mountpoint -q "$mountpoint"; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - Successfully remounted $mountpoint."
else
echo "$(date '+%Y-%m-%d %H:%M:%S') - Remount failed for $mountpoint."
fi
fi
done
Scheduling Automation with Cron: Using the powerful management interface Webmin, we easily set up this script to run every 5 minutes as a scheduled cron job. Webmin simplifies managing Linux servers, combining a friendly graphical interface with robust functionality, suitable even for command-line experts.

Using the Webmin interface we can easily view and edit the cron schedule
Leveraging Webmin for Simpler Server Management
Webmin offers intuitive access to cron management, file permissions, and log rotation—critical tasks for keeping automation running smoothly:
Cron Management:Â Webmin clearly displays your scheduled tasks, making adjustments straightforward without needing manual edits in the command line.
File Management:Â You can quickly upload scripts, set permissions, and manage server files directly from Webmin's interface.
Log Management: Easily set up log rotation to ensure your logs remain manageable and don’t consume unnecessary storage space over time.

Without this the log for the job would grow indefinitely wasting space.
Other Practical Uses for Cron and Automation
Beyond network shares, scripting and cron automation can significantly streamline your business operations, such as:
Backup Automation:Â Regularly scheduled backups of critical data, databases, or configuration files.
System Maintenance:Â Automated updates, security patching, and system clean-ups.
Resource Monitoring:Â Periodically checking server health metrics (disk space, memory usage, CPU load) and sending alerts if thresholds are exceeded.
File Synchronization:Â Automating the synchronization of files between locations or servers, enhancing redundancy and reliability.

Benefits of This Automation Approach
Improved Reliability:Â Minimized downtime due to disconnected shares.
Time Savings:Â Reduced manual intervention, freeing your team to focus on higher-value tasks.
Proactive Monitoring:Â Built-in logging provides clarity and easy troubleshooting.
Bringing Automation to Your Business
If your business relies on consistent server availability or faces similar connectivity challenges, implementing automation scripts is a powerful and effective solution. SeraphimGate Systems specializes in identifying automation opportunities, documenting processes, and delivering tailored, robust solutions.
Ready to streamline your server management and keep your business running smoothly?
Contact us today for a personalized consultation on automation solutions tailored specifically to your needs.