惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
U
Unit 42
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
小众软件
小众软件
V
Visual Studio Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 叶小钗
GbyAI
GbyAI
爱范儿
爱范儿
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
博客园_首页
D
Docker
A
About on SuperTechFans
G
Google Developers Blog
I
InfoQ
T
The Blog of Author Tim Ferriss
V
V2EX
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How GBase 8a Resource Plans Bind to Time Schedules
Michael · 2026-05-15 · via DEV Community

Michael

Resource plans in GBase 8a (e.g., plan_day, plan_night) are not directly bound to time and do not support cron expressions. Their automated switching relies entirely on external schedulers — such as Linux crontab — that execute ACTIVE / DEACTIVE commands at the right moment.

Core Mechanism: External Trigger, Internal Execution

A resource plan is just a "policy container" — it takes effect only when activated (ACTIVE). GBase 8a has no built‑in timer, so the full automation chain is:

  1. External scheduler (crontab, etc.) fires at the scheduled time.
  2. A script connects to the database and runs the ACTIVE/DEACTIVE RESOURCE PLAN command.
  3. The plan swap takes effect.

Manual Switching Commands

-- Activate the daytime plan
ACTIVE RESOURCE PLAN plan_day ON VC vc1;

-- Deactivate the current plan
DEACTIVE RESOURCE PLAN ON VC vc1;

-- Activate the nighttime plan
ACTIVE RESOURCE PLAN plan_night ON VC vc1;

Enter fullscreen mode Exit fullscreen mode

Automating with Crontab

  1. Create a switching script (e.g., switch_plan.sh):
#!/bin/bash
GC_CLI_PATH=/opt/gbase/bin/gccli
VC_NAME=vc1
USER=gbase
PASSWORD='your_password'

# Deactivate the current plan, then activate the nighttime plan
$GC_CLI_PATH -u$USER -p$PASSWORD -e "DEACTIVE RESOURCE PLAN ON VC $VC_NAME; ACTIVE RESOURCE PLAN plan_night ON VC $VC_NAME;"

Enter fullscreen mode Exit fullscreen mode

  1. Set up crontab entries:
# Activate daytime plan every day at 8:00 AM
0 8 * * * /opt/gbase/bin/gccli -ugbase -p'password' -e "ACTIVE RESOURCE PLAN plan_day ON VC vc1;"

# Switch to nighttime plan every day at 8:00 PM
0 20 * * * /home/gbase/switch_plan.sh

Enter fullscreen mode Exit fullscreen mode

Make sure the executing user is allowed in /etc/cron.allow.

Why No Built‑in Cron‑Like Scheduler?

  • Separation of concerns: The database focuses on enforcing resource limits; external tools handle complex scheduling logic.
  • Flexibility: External scripts can switch plans based on load or other conditions, not just time.
  • Maintainability: Adjusting switch times only requires changing the external script — no database object modifications, reducing risk.

Production Recommendations

  • Prefer enterprise scheduling platforms (like GDOM) or job orchestration systems.
  • Ensure the account running the commands (e.g., gbase) has the necessary privileges.
  • Add logging and error alerts to your scripts so you can monitor switch events in your gbase database.

This design keeps the gbase database lean and gives you full control over when and how resource plans change.