-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sql
More file actions
31 lines (26 loc) · 1.03 KB
/
bootstrap.sql
File metadata and controls
31 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
create or replace table qtemp.ftpcmd(cmd char(240)) on replace delete rows;
create or replace table qtemp.ftplog(line char(240)) on replace delete rows;
insert into qtemp.ftpcmd(CMD) values
('anonymous anonymous@example.com')
,('namefmt 1')
,('lcd /tmp')
,('cd /software/ibmi/products/pase/rpms')
,('bin')
,('get README.md (replace')
,('get bootstrap.tar.Z (replace')
,('get bootstrap.sh (replace')
with nc
;
CL:OVRDBF FILE(INPUT) TOFILE(QTEMP/FTPCMD) MBR(*FIRST) OVRSCOPE(*JOB);
CL:OVRDBF FILE(OUTPUT) TOFILE(QTEMP/FTPLOG) MBR(*FIRST) OVRSCOPE(*JOB);
CL:FTP RMTSYS('public.dhe.ibm.com');
CL:QSH CMD('touch -C 819 /tmp/bootstrap.log; /QOpenSys/usr/bin/ksh /tmp/bootstrap.sh > /tmp/bootstrap.log 2>&1');
select
case when (message_tokens = X'00000000')
then 'Bootstrapping successful! Review /tmp/README.md for more info'
else 'Bootstrapping failed. Consult /tmp/bootstrap.log for more info'
end as result
from table(qsys2.joblog_info('*')) x
where message_id = 'QSH0005'
order by message_timestamp desc
fetch first 1 rows only;