npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ho-aliyun-swas-disk-auto-snapshot

v1.1.1

Published

Aliyun SWAS disk automatic snapshot management tool

Downloads

6

Readme

ho-aliyun-swas-disk-auto-snapshot

English | 简体中文

Aliyun SWAS (Simple Application Server) disk automatic snapshot management tool. This tool helps you automatically create snapshots for your SWAS disks and clean up old snapshots based on retention policies.

Features

  • List all snapshots for a disk
  • Create snapshots manually or automatically
  • Delete snapshots
  • Clean old snapshots based on retention policy
  • Automatic snapshot management (clean old + create new)

Installation

npm install -g ho-aliyun-swas-disk-auto-snapshot

Or use locally:

npm install ho-aliyun-swas-disk-auto-snapshot

Configuration

1. Aliyun Credentials

Configure your Aliyun credentials using one of these methods:

Method 1: Environment Variables

export ALIBABA_CLOUD_ACCESS_KEY_ID=your-access-key-id
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your-access-key-secret

Method 2: Aliyun CLI Profile

aliyun configure

Method 3: ECS RAM Role (if running on Aliyun ECS)

See Aliyun Credentials Documentation for more details.

2. Environment Configuration

Create a .env file in your project root (copy from .env.example):

cp .env.example .env

Edit .env file:

# Required: Your SWAS disk ID
ALIYUN_DISK_ID=d-xxxxxxxxxxxxxx

# Optional: Region ID (default: cn-hongkong)
ALIYUN_REGION_ID=cn-hongkong

# Optional: API endpoint
ALIYUN_ENDPOINT=swas.cn-hongkong.aliyuncs.com

# Optional: Number of days to retain old snapshots (default: 7)
RETENTION_DAYS=7

# Optional: Prefix for auto-generated snapshot names (default: Auto)
# Note: Must start with uppercase letter
SNAPSHOT_PREFIX=Auto

# Optional: Maximum number of auto snapshots to keep
# 0 disables count-based pruning (default: 0)
# Example: keep at most 30 auto snapshots
MAX_SNAPSHOTS=0

CLI Usage

Command aliases:

  • ho-aliyun-swas-snapshot (short)
  • ho-aliyun-swas-disk-auto-snapshot (same as package name)

List Snapshots

ho-aliyun-swas-snapshot list
# With options
ho-aliyun-swas-snapshot list --region cn-hongkong --disk d-xxxxx

Create Snapshot

ho-aliyun-swas-snapshot create
# With custom name
ho-aliyun-swas-snapshot create --name "my-snapshot"
# With specific disk
ho-aliyun-swas-snapshot create --disk d-xxxxx

Delete Snapshot

ho-aliyun-swas-snapshot delete <snapshot-id>

Clean Old Snapshots

ho-aliyun-swas-snapshot clean
# With custom retention period
ho-aliyun-swas-snapshot clean --retention 14
# With count-based pruning (e.g., keep at most 30 auto snapshots)
ho-aliyun-swas-snapshot clean --max 30

Auto Snapshot (Clean + Create)

ho-aliyun-swas-snapshot auto
# With custom options
ho-aliyun-swas-snapshot auto --retention 7 --prefix "Auto" --max 30

Programmatic Usage

import { SnapshotManager } from 'ho-aliyun-swas-disk-auto-snapshot';

const manager = new SnapshotManager({
  regionId: 'cn-hongkong',
  diskId: 'd-xxxxxxxxxxxxx',
  retentionDays: 7,
  snapshotPrefix: 'Auto',
  maxSnapshots: 30,
});

// List snapshots
const snapshots = await manager.listSnapshots();

// Create snapshot
const snapshotId = await manager.createSnapshot('my-snapshot');

// Delete snapshot
await manager.deleteSnapshot('s-xxxxxxxxxxxxx');

// Clean old snapshots
const deletedCount = await manager.cleanOldSnapshots();

// Auto snapshot (clean + create)
await manager.autoSnapshot();

Quick Installation

Use the installation script for quick setup:

# Download and run installation script
curl -sSL https://raw.githubusercontent.com/willkan/ho-aliyun-swas-disk-auto-snaphot/main/install.sh | bash

# Or clone and run locally
git clone https://github.com/willkan/ho-aliyun-swas-disk-auto-snaphot.git
cd ho-aliyun-swas-disk-auto-snaphot
./install.sh

Cron Job Setup

For detailed cron configuration, see CRON_SETUP.md.

Quick setup for daily snapshots:

# Edit crontab
crontab -e

# Add daily snapshot at 2:00 AM
0 2 * * * ~/swas-snapshot-config/run-snapshot.sh >> ~/swas-snapshot-config/logs/snapshot.log 2>&1

Development

# Clone repository
git clone https://github.com/willkan/ho-aliyun-swas-disk-auto-snaphot.git
cd ho-aliyun-swas-disk-auto-snaphot

# Install dependencies
npm install

# Build
npm run build

# Run CLI locally
node dist/cli.js list

License

MIT