Giter VIP home page Giter VIP logo

openwrt's Introduction

CPU Governor Selection Script

This script allows you to set the CPU governor mode for all CPUs on your system. The available governor modes are performance and powersave.

Description

The script lists available CPU governor modes and prompts the user to select one. It then applies the selected governor mode to all CPUs where applicable. The script ensures that the change is applied and confirms the current governor settings for all CPUs.

Automatic Backup Service Script for OpenWrt

Overview

This script provides an automatic backup service for OpenWrt. It continuously monitors specific system directories for any changes and creates backups whenever modifications are detected. The service is designed to start with the system and run in the background, ensuring that your configurations are always backed up.

How It Works

  • Monitored Directories: The script watches the /etc/config, /etc/init.d, and /etc/rc.d directories for any changes.
  • Reference File: A reference file (.last_backup) is used to keep track of the last backup time.
  • Change Detection: The script uses the find command to check if any files in the monitored directories have been modified since the last backup.
  • Backup Creation: If changes are detected, a backup is created using the sysupgrade command, and the reference file is updated to the current time.
  • Service Integration: The script is integrated into OpenWrt's init system, ensuring it starts automatically on boot and runs continuously.

Make the Script Executable

chmod +x /root/scripts/backup_on_change.sh

Create the Service Script

#!/bin/sh /etc/rc.common

START=99
STOP=1

start() {
    echo "Starting backup on change service"
    /root/scripts/backup_on_change.sh &
}

stop() {
    echo "Stopping backup on change service"
    killall backup_on_change.sh
}

Make the Service Script Executable

chmod +x /etc/init.d/backup_on_change

Enable and Start the Service

/etc/init.d/backup_on_change enable
/etc/init.d/backup_on_change start

Configuration

In the backup script, change the line mkdir -p /mnt/externaldisk/bkps/ to your desired backup path:

# Change here to your backup path
mkdir -p /mnt/externaldisk/bkps/

Conclusion

This setup ensures that your OpenWrt configurations are backed up automatically whenever changes are detected, providing an additional layer of security and convenience.

Schedule tasks or CRON

You can use the backup command directly in the cron or scheduled tasks of the LUCI graphical interface, as in the example below

# /mnt/externaldisk/bkps/ == $path
00 10 * * * mkdir -p /mnt/externaldisk/bkps/ && sysupgrade -b /mnt/externaldisk/bkps/backup-${HOSTNAME}-$(date +\%F-\%H\%M\%S)-$(date +\%N).tar.gz

openwrt's People

Contributors

casquijo avatar

Stargazers

Glenn Fowler avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.